|
@@ -28,15 +28,16 @@ $(document).ready(() => {
|
|
|
{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: 230, 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: 'quantity', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {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'},
|
|
|
{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|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},
|
|
|
- {title: '本期材料调差|风险幅度(%)', colSpan: '3|1', rowSpan: '1|1', field: 'm_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_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_spread'},
|
|
|
{title: '|调整金额', colSpan: '|1', rowSpan: '1|1', field: 'm_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_tp'},
|
|
|
{title: '截止上期调差金额', colSpan: '1', rowSpan: '2', field: 'pre_tp', hAlign: 2, width: 120, type: 'Number', readOnly: true},
|
|
@@ -62,15 +63,15 @@ $(document).ready(() => {
|
|
|
const materialCol = {
|
|
|
getValue: {
|
|
|
msg_spread: function (data) {
|
|
|
- return ZhCalc.sub(data.msg_tp, data.basic_price);
|
|
|
+ return ZhCalc.round(ZhCalc.sub(data.msg_tp, data.basic_price), 2);
|
|
|
},
|
|
|
m_spread : function (data) {
|
|
|
- const cor = ZhCalc.mul(data.basic_price, ZhCalc.div(data.m_risk, 100));
|
|
|
const msg_spread = materialCol.getValue.msg_spread(data);
|
|
|
- return Math.abs(msg_spread) > Math.abs(cor) ? (msg_spread > 0 ? ZhCalc.sub(msg_spread, cor) : ZhCalc.add(msg_spread, cor)) : 0;
|
|
|
+ const cor = msg_spread >= 0 ? ZhCalc.mul(data.basic_price, ZhCalc.div(data.m_up_risk, 100)) : ZhCalc.mul(data.basic_price, ZhCalc.div(data.m_down_risk, 100));
|
|
|
+ return Math.abs(msg_spread) > Math.abs(cor) ? (msg_spread > 0 ? ZhCalc.round(ZhCalc.sub(msg_spread, cor), 2) : ZhCalc.round(ZhCalc.add(msg_spread, cor), 2)) : 0;
|
|
|
},
|
|
|
m_tp: function (data) {
|
|
|
- return ZhCalc.mul(materialCol.getValue.m_spread(data), data.quantity);
|
|
|
+ return ZhCalc.round(ZhCalc.mul(materialCol.getValue.m_spread(data), data.quantity), 2);
|
|
|
}
|
|
|
},
|
|
|
readOnly: {
|
|
@@ -151,6 +152,12 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
+ const num = parseFloat(validText);
|
|
|
+ if (num < 0 || !/^\d+(\.\d{1,3})?$/.test(num)) {
|
|
|
+ toastr.error('请输入大于0并且小于3位小数的浮点数');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
if (col.field === 'msg_tp') {
|
|
|
if (isNaN(validText)) {
|
|
@@ -158,14 +165,40 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
+ const num = parseFloat(validText);
|
|
|
+ if (num < 0 || !/^\d+(\.\d{1,3})?$/.test(num)) {
|
|
|
+ toastr.error('请输入大于0并且小于3位小数的浮点数');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- if (col.field === 'm_risk') {
|
|
|
+ if (col.field === 'm_up_risk') {
|
|
|
// 只能输入正整数
|
|
|
if (isNaN(validText)) {
|
|
|
toastr.error('不能输入其它非数字类型字符');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
+ const num = parseFloat(validText);
|
|
|
+ if (num < 0 || num > 100 || !/^\d+$/.test(num)) {
|
|
|
+ toastr.error('只能输入0-100的正整数');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (col.field === 'm_down_risk') {
|
|
|
+ // 只能输入正整数
|
|
|
+ if (isNaN(validText)) {
|
|
|
+ toastr.error('不能输入其它非数字类型字符');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const num = parseFloat(validText);
|
|
|
+ if (num < 0 || num > 100 || !/^\d+$/.test(num)) {
|
|
|
+ toastr.error('只能输入0-100的正整数');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
select[col.field] = validText;
|