@@ -331,113 +326,48 @@
columns: [
{checkbox: true},
{field: 'index',align: 'center', title: "序号",
- formatter: function (value, row, index) {
- var columnIndex = $.common.sprintf("
", $.table.serialNumber(index));
- return columnIndex + $.table.serialNumber(index);
+ formatter: function (value, row, index,column) {
+ return $.table.serialNumber(index) - 1;
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
- {title: '图片',field: 'photoUrl',
- formatter: function(value, row, index) {
- return $.table.imageView(value);
- }
- },
- {title: '物料类型',field: 'materialType',align: 'center',
- formatter: function(value, row, index) {
- return $.table.selectCategoryLabel(materialTypeDatas, value);
- }
- },
+ {title: '图片',field: 'photoUrl',formatter: function(value, row, index) {return $.table.imageView(value);} },
+ {title: '物料类型',field: 'materialType',align: 'center',formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}},
{ title: '描述',field: 'describe',align: 'center'},
{title: '品牌',field: 'brand',align: 'center'},
- { title: '单位',field: 'unit',align: 'center',
- formatter: function(value, row, index) {
- return $.table.selectDictLabel(sysUnitClassDatas, value);
- }
- },
- {title: '半成品类型',field: 'processMethod',align: 'center',
- formatter: function(value, row, index) {
- return $.table.selectDictLabel(processMethodDatas, value);
- }
- },
- { title: '对外售价',field: 'materialSole',editable: false},
- {title: '国内税率',field: 'countTax',align: 'center',editable: false},
- { title: '美元汇率',field: 'usdTax', align: 'center',editable: false},
- {title: '物料的数量',field: 'materialNum',align: 'center',editable: false},
+ { title: '单位',field: 'unit',align: 'center', formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}},
+ {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}},
+ { title: '对外售价',field: 'materialSole'},
+ {title: '国内税率',field: 'countTax',align: 'center'},
+ { title: '美元汇率',field: 'usdTax', align: 'center'},
{ title: '物料的不含税单价(RMB)',
field: 'materialNoRmb',
- align: 'center',
- editable: {
- type: 'text', mode: 'inline', // 同样设定为行内编辑模式
- enabled: function() {return false; },
- options: {placeholder: '请输入USD单价...', maxlength: 10}
- }
+ align: 'center'
},
+ { title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',},
+ {field: 'materialNum',align: 'center',title: '物料的数量',
+ },
+ {title: '物料的不含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
+ { title: '物料的含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '物料的不含税单价(美元)',
field: 'materialNoUsd',
align: 'center',
- editable: {
- type: 'text', mode: 'inline', // 同样设定为行内编辑模式
- enabled: function() {return false; },
- options: {placeholder: '请输入USD单价...', maxlength: 10}
- }
},
- { title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center'},
- { title: '物料的含税总价(美元)',field: 'materialUsdSum',align: 'center'},
- { title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center'},
- { title: '物料的含税总价(RMB)',field: 'materialNoRmbSum', align: 'center'},
- { title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'},
- { title: '录入人',field: 'createBy',align: 'center',visible: false},
- { title: '录入时间',field: 'createTime',align: 'center',visible: false},
- { title: '更新人',field: 'updateBy',align: 'center',visible: false},
- { title: '上次更新时间',field: 'updateTime',align: 'center',visible: false},
- { title: '备注',field: 'remark',align: 'center', visible: false },
- { title: '审核状态',field: 'auditStatus',align: 'center',visible: false,
+ { title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',},
+ { title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',},
+ { title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',},
+ { title: '计划交付时间',field: 'deliveryTime',align: 'center' },
+ {title: '质保天数',align: 'center',field: 'expiryDay',
+ },
+ {field: 'remark',align: 'center',title: '备注',},
+ {field: 'auditStatus',align: 'center',title: '审核状态',visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);
}
},
- {title: '操作', align: 'center',
- formatter: function (value, row, index) {
- var actions = [];
- actions.push('
删除 ');
- return actions.join('');
- }
- }
],
- onEditableSave:function(field, row, oldValue, $el){
- var commonCurrency1 = $("#commonCurrency_edit option:selected").val();
- var rmbRateInput = parseFloat($("#rmbTax_edit").val()) || 0;
- var rmbRate = rmbRateInput / 100;
- rmbRate = parseFloat(rmbRate.toFixed(2)); // 确保rmbRate转换为两位小数的浮点数
- var usdRate = parseFloat($("#usdTax_edit").val()) || 0;
- var testMaterialNum = parseFloat(row.materialNum) || 0;
- if (commonCurrency1 === '1') {
- // RMB为基准货币
- row.materialRmb = (parseFloat(row.materialNoRmb) * (1 + rmbRate)).toFixed(2);
- row.materialRmbSum = (parseFloat(row.materialRmb) * testMaterialNum).toFixed(2);
- row.materialNoRmbSum = (parseFloat(row.materialNoRmb) * testMaterialNum).toFixed(2);
- row.materialNoUsd = (parseFloat(row.materialNoRmb) / usdRate).toFixed(2);
- row.materialUsd = row.materialNoUsd; // 保持一致,除非有特别的计算逻辑
- row.materialUsdSum = (parseFloat(row.materialUsd) * testMaterialNum).toFixed(2);
- row.materialNoUsdSum = (parseFloat(row.materialNoUsd) * testMaterialNum).toFixed(2);
- } else if (commonCurrency1 === '2') {
- // USD为基准货币
- row.materialUsd = row.materialNoUsd
- row.materialUsdSum = (parseFloat(row.materialUsd) * testMaterialNum).toFixed(2);
- row.materialNoUsdSum = (parseFloat(row.materialNoUsd) * testMaterialNum).toFixed(2);
- row.materialNoRmb = (parseFloat(row.materialNoUsd) * usdRate).toFixed(2);
- row.materialRmb = (parseFloat(row.materialNoRmb) * (1 + rmbRate)).toFixed(2);
- row.materialNoRmbSum = (parseFloat(row.materialNoRmb) * testMaterialNum).toFixed(2);
- row.materialRmbSum = (parseFloat(row.materialRmb) * testMaterialNum).toFixed(2);
- }
-
- // 确保getTotalAmount函数存在且正确引用
- if (typeof getTotalAmount === 'function') {
- getTotalAmount();
- }
- },
};
$.table.init(options);
$.ajax({
@@ -628,44 +558,7 @@
minView: "month",
autoclose: true
});
- //计算
- function getTotalAmount(){
- // $("#addFinishbomTable").bootstrapTable('refresh');
- let getData = $("#bootstrap-sub-table-editOrder2").bootstrapTable('getData',true);
- let enterprise = 0;let enterpriseSum = 0; let noRmb = 0;
- let rmb = 0;let noRmbSum =0;let rmbSum = 0;
- let noUsd = 0;let usd = 0;let noUsdSum =0; let usdSum = 0;
- enterprise = getData.length; // 直接获取数据长度
- enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
- for(var i=0;i