|
@@ -40,64 +40,70 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- gclGatherModel.loadLedgerData(ledger);
|
|
|
- gclGatherModel.loadPosData(pos);
|
|
|
- const gclGatherData = gclGatherModel.gatherGclData();
|
|
|
- for (const ggd in gclGatherData) {
|
|
|
- gclGatherData[ggd].code = gclGatherData[ggd].b_code;
|
|
|
- }
|
|
|
- // 数组去重
|
|
|
- for (const db of gclGatherData) {
|
|
|
- const exist_index = dealBillList.findIndex(function (item) {
|
|
|
- return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price;
|
|
|
- });
|
|
|
- if (exist_index !== -1) {
|
|
|
- dealBillList.splice(exist_index, 1);
|
|
|
+ const preUrl = window.location.pathname.split('/').slice(0, 4).join('/');
|
|
|
+ let changeListData;
|
|
|
+ postData(preUrl + '/defaultBills', {}, function (result) {
|
|
|
+ gclGatherModel.loadLedgerData(result.bills);
|
|
|
+ gclGatherModel.loadPosData(result.pos);
|
|
|
+
|
|
|
+ const gclGatherData = gclGatherModel.gatherGclData();
|
|
|
+ for (const ggd in gclGatherData) {
|
|
|
+ gclGatherData[ggd].code = gclGatherData[ggd].b_code;
|
|
|
}
|
|
|
- }
|
|
|
- const changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
|
|
|
- console.log(changeListData);
|
|
|
- // 先加载台账数据
|
|
|
- let listHtml = '';
|
|
|
- let list_index = 1;
|
|
|
- let gcl_index = 0;
|
|
|
- for (const gcl of changeListData) {
|
|
|
- const unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
|
|
|
- const quantity = gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? roundnum(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
|
|
|
- const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
|
|
|
- let gclhtml = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? ' data-gcl="' + gcl_index + '"': '';
|
|
|
- gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
|
|
|
- const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
|
|
|
- listHtml += '<tr data-lid="' + lid + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
|
|
|
- '<td>' + list_index + '</td>' +
|
|
|
- '<td>' + gcl.code + '</td>' +
|
|
|
- '<td>' + gcl.name + '</td>' +
|
|
|
- '<td>' + unit + '</td>' +
|
|
|
- '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
|
|
|
- '<td>' + quantity + '</td>' +
|
|
|
- // '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
|
|
|
- '</tr>';
|
|
|
- list_index++;
|
|
|
- }
|
|
|
- // // 再加载签约清单
|
|
|
- // for (const db of dealBillList) {
|
|
|
- // const unit = db.unit !== undefined && db.unit !== null ? db.unit : '';
|
|
|
- // const quantity = db.quantity !== null && db.quantity !== undefined ? (unit !== '' ? roundnum(db.quantity, findDecimal(db.unit)) : db.quantity) : 0;
|
|
|
- // const unit_price = db.unit_price !== null && db.unit_price !== undefined ? db.unit_price : 0;
|
|
|
- // listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-bwmx="">' +
|
|
|
- // '<td>' + list_index + '</td>' +
|
|
|
- // '<td>' + db.code + '</td>' +
|
|
|
- // '<td>' + db.name + '</td>' +
|
|
|
- // '<td>' + unit + '</td>' +
|
|
|
- // '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
|
|
|
- // '<td>' + quantity + '</td>' +
|
|
|
- // // '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
|
|
|
- // '</tr>';
|
|
|
- // list_index++;
|
|
|
- // }
|
|
|
- $('#table-list-select').html(listHtml);
|
|
|
- tableDataRemake(changeListData);
|
|
|
- maketablelist();
|
|
|
+ // 数组去重
|
|
|
+ const dealBillList = result.dealBills;
|
|
|
+ for (const db of gclGatherData) {
|
|
|
+ const exist_index = dealBillList.findIndex(function (item) {
|
|
|
+ return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price;
|
|
|
+ });
|
|
|
+ if (exist_index !== -1) {
|
|
|
+ dealBillList.splice(exist_index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
|
|
|
+ console.log(changeListData);
|
|
|
+ // 先加载台账数据
|
|
|
+ let listHtml = '';
|
|
|
+ let list_index = 1;
|
|
|
+ let gcl_index = 0;
|
|
|
+ for (const gcl of changeListData) {
|
|
|
+ const unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
|
|
|
+ const quantity = gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? roundnum(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
|
|
|
+ const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
|
|
|
+ let gclhtml = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? ' data-gcl="' + gcl_index + '"': '';
|
|
|
+ gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
|
|
|
+ const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
|
|
|
+ listHtml += '<tr data-lid="' + lid + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
|
|
|
+ '<td>' + list_index + '</td>' +
|
|
|
+ '<td>' + gcl.code + '</td>' +
|
|
|
+ '<td>' + gcl.name + '</td>' +
|
|
|
+ '<td>' + unit + '</td>' +
|
|
|
+ '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
|
|
|
+ '<td>' + quantity + '</td>' +
|
|
|
+ // '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
|
|
|
+ '</tr>';
|
|
|
+ list_index++;
|
|
|
+ }
|
|
|
+ // // 再加载签约清单
|
|
|
+ // for (const db of dealBillList) {
|
|
|
+ // const unit = db.unit !== undefined && db.unit !== null ? db.unit : '';
|
|
|
+ // const quantity = db.quantity !== null && db.quantity !== undefined ? (unit !== '' ? roundnum(db.quantity, findDecimal(db.unit)) : db.quantity) : 0;
|
|
|
+ // const unit_price = db.unit_price !== null && db.unit_price !== undefined ? db.unit_price : 0;
|
|
|
+ // listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-bwmx="">' +
|
|
|
+ // '<td>' + list_index + '</td>' +
|
|
|
+ // '<td>' + db.code + '</td>' +
|
|
|
+ // '<td>' + db.name + '</td>' +
|
|
|
+ // '<td>' + unit + '</td>' +
|
|
|
+ // '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
|
|
|
+ // '<td>' + quantity + '</td>' +
|
|
|
+ // // '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
|
|
|
+ // '</tr>';
|
|
|
+ // list_index++;
|
|
|
+ // }
|
|
|
+ $('#table-list-select').html(listHtml);
|
|
|
+ tableDataRemake(changeListData);
|
|
|
+ maketablelist();
|
|
|
+ });
|
|
|
|
|
|
// 上报时按钮点击
|
|
|
$('a[data-target="#sub-ap"]').on('click', function () {
|