|
@@ -20,62 +20,56 @@ 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 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({});
|
|
|
|
+ $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 ? new Date(value) : new Date());
|
|
|
|
+};
|
|
|
|
+DatePickerCellType.prototype.getEditorValue = function (editor, context) {
|
|
|
|
+ // console.log($(editor).datepicker().data('datepicker'), context);
|
|
|
|
+ //Sync value from editor value to cell value.
|
|
|
|
+ // console.log($(editor).datepicker("getDate"));
|
|
|
|
+ // 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() {
|
|
function resetTpTable() {
|
|
const rate = $('#changeRate').val();
|
|
const rate = $('#changeRate').val();
|
|
@@ -113,9 +107,9 @@ $(document).ready(() => {
|
|
{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: '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: '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_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'},
|
|
|
|
|
|
+ {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
{title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
- {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
|
|
|
+ {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '|价差', colSpan: '1', rowSpan: '1|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},
|
|
{title: '|价差', colSpan: '1', rowSpan: '1|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},
|
|
{title: '本期材料调差|上涨幅度(%)', colSpan: '4|1', rowSpan: '1|1', field: 'm_up_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
{title: '本期材料调差|上涨幅度(%)', colSpan: '4|1', rowSpan: '1|1', field: 'm_up_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
{title: '|下跌幅度(%)', colSpan: '|1', rowSpan: '|1', field: 'm_down_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
{title: '|下跌幅度(%)', colSpan: '|1', rowSpan: '|1', field: 'm_down_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
@@ -480,13 +474,15 @@ $(document).ready(() => {
|
|
materialSpread.bind(spreadNS.Events.SelectionChanged, materialSpreadObj.selectionChanged);
|
|
materialSpread.bind(spreadNS.Events.SelectionChanged, materialSpreadObj.selectionChanged);
|
|
materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
|
|
materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
|
|
SpreadJsObj.addDeleteBind(materialSpread, materialSpreadObj.deletePress);
|
|
SpreadJsObj.addDeleteBind(materialSpread, materialSpreadObj.deletePress);
|
|
- // 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();
|
|
|
|
|
|
+ const sheet = materialSpread.getActiveSheet();
|
|
|
|
+ sheet.suspendPaint();
|
|
|
|
+ const basic_range = sheet.getRange(-1, 8, -1, 1);
|
|
|
|
+ basic_range.cellType(new DatePickerCellType());
|
|
|
|
+ basic_range.formatter("yyyy-MM-dd");
|
|
|
|
+ const msg_range = sheet.getRange(-1, 10, -1, 1);
|
|
|
|
+ msg_range.cellType(new DatePickerCellType());
|
|
|
|
+ msg_range.formatter("yyyy-MM-dd");
|
|
|
|
+ sheet.resumePaint();
|
|
|
|
|
|
if (!readOnly) {
|
|
if (!readOnly) {
|
|
$('#add').click(materialSpreadObj.add);
|
|
$('#add').click(materialSpreadObj.add);
|