还需要优化一下:
1、加入四舍五入;
2、现在表格数据传递命令 传到单价列不能触发js 必须受到输入才能触发js;
var listviewName = "销售合同子表";
var sumCol = 7;
var countCol = 8;
var djName = "dj";
var jjName = "jj";
var dwggName = "dwgg";
var isChanging = false;
var listview = Forguncy.Page.getListView(listviewName);
listview.bind(Forguncy.ListViewEvents.ValueChanged, function (arg1, arg2) {
if (isChanging) {
return;
}
var listview = Forguncy.Page.getListView(listviewName);
var cellRange = arg2.CellRanges[0];
try {
isChanging = true;
if (cellRange.RowCount === 1 && cellRange.ColumnCount === 1) {
var row = cellRange.Row;
if (cellRange.Column === sumCol) {
listview.setValue(row, jjName, listview.getValue(row, djName) * listview.getValue(row, dwggName));
} else if (cellRange.Column === countCol) {
listview.setValue(row, djName,listview.getValue(row, jjName) / listview.getValue(row, dwggName));
}
}
} finally {
isChanging = false;
}
});
|
|