|
@@ -637,6 +637,8 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
} else if (!position) {
|
|
} else if (!position) {
|
|
toast('新增部位请先输入名称', 'warning');
|
|
toast('新增部位请先输入名称', 'warning');
|
|
|
|
+ info.cancel = true;
|
|
|
|
+ return;
|
|
} else {
|
|
} else {
|
|
data.updateType = 'update';
|
|
data.updateType = 'update';
|
|
data.updateData = {id: position.id};
|
|
data.updateData = {id: position.id};
|
|
@@ -873,6 +875,7 @@ $(document).ready(function() {
|
|
{title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
|
|
{title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
|
|
{title: '单价', field: 'unit_price', width: 50, readOnly: true},
|
|
{title: '单价', field: 'unit_price', width: 50, readOnly: true},
|
|
{title: '数量', field: 'quantity', width: 50, readOnly: true},
|
|
{title: '数量', field: 'quantity', width: 50, readOnly: true},
|
|
|
|
+ {title: '金额', field: 'total_price', width: 50, readOnly: true},
|
|
],
|
|
],
|
|
emptyRows: 0,
|
|
emptyRows: 0,
|
|
headRows: 1,
|
|
headRows: 1,
|
|
@@ -964,6 +967,8 @@ $(document).ready(function() {
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
formData.append('file', file.files[0]);
|
|
formData.append('file', file.files[0]);
|
|
postDataWithFile(self.url+'/upload-excel', formData, function (data) {
|
|
postDataWithFile(self.url+'/upload-excel', formData, function (data) {
|
|
|
|
+ self.data = data;
|
|
|
|
+ self.calculateData();
|
|
SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
$('#upload-deal').modal('hide');
|
|
$('#upload-deal').modal('hide');
|
|
}, function () {
|
|
}, function () {
|
|
@@ -974,10 +979,18 @@ $(document).ready(function() {
|
|
loadData () {
|
|
loadData () {
|
|
const self = this;
|
|
const self = this;
|
|
postData(this.url+'/get-data', {}, function (data) {
|
|
postData(this.url+'/get-data', {}, function (data) {
|
|
- this.data = data;
|
|
|
|
|
|
+ self.data = data;
|
|
|
|
+ self.calculateData();
|
|
SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ calculateData () {
|
|
|
|
+ if (this.data) {
|
|
|
|
+ for (const d of this.data) {
|
|
|
|
+ d.total_price = _.multiply(d.quantity, d.unit_price);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
class BatchInsertBillsPosObj {
|
|
class BatchInsertBillsPosObj {
|
|
constructor (obj) {
|
|
constructor (obj) {
|