|
@@ -9,6 +9,40 @@
|
|
|
*/
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
+
|
|
|
+ gclGatherModel.loadLedgerData(ledger);
|
|
|
+ gclGatherModel.loadPosData(pos);
|
|
|
+ const gclGatherData = gclGatherModel.gatherGclData();
|
|
|
+ // 先加载台账数据
|
|
|
+ let listHtml = '';
|
|
|
+ let list_index = 1;
|
|
|
+ for (const gcl of gclGatherData) {
|
|
|
+ listHtml += '<tr data-lid="' + list_index + '" data-gcl="' + (list_index-1) + '" data-index="' + list_index + '" data-detail="">' +
|
|
|
+ '<td>' + list_index + '</td>' +
|
|
|
+ '<td>' + gcl.b_code + '</td>' +
|
|
|
+ '<td>' + gcl.name + '</td>' +
|
|
|
+ '<td>' + gcl.unit + '</td>' +
|
|
|
+ '<td>' + roundnum(gcl.unit_price, totalPriceUnit) + '</td>' +
|
|
|
+ '<td>' + roundnum(gcl.quantity, gcl.unit) + '</td>' +
|
|
|
+ '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
|
|
|
+ '</tr>';
|
|
|
+ list_index++;
|
|
|
+ }
|
|
|
+ // 再加载签约清单
|
|
|
+ for (const db of dealBillList) {
|
|
|
+ listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-detail="">' +
|
|
|
+ '<td>' + list_index + '</td>' +
|
|
|
+ '<td>' + db.code + '</td>' +
|
|
|
+ '<td>' + db.name + '</td>' +
|
|
|
+ '<td>' + db.unit + '</td>' +
|
|
|
+ '<td>' + roundnum(db.unit_price, totalPriceUnit) + '</td>' +
|
|
|
+ '<td>' + roundnum(db.quantity, findDecimal(db.unit)) + '</td>' +
|
|
|
+ '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
|
|
|
+ '</tr>';
|
|
|
+ list_index++;
|
|
|
+ }
|
|
|
+ $('#table-list-select').html(listHtml);
|
|
|
+
|
|
|
// 上报时按钮点击
|
|
|
$('a[data-target="#sub-ap"]').on('click', function () {
|
|
|
let category = $(this).data('category');
|
|
@@ -163,17 +197,53 @@ $(document).ready(() => {
|
|
|
// 打开签约清单modal并删除之前的操作
|
|
|
$('#open-list-modal').click(function () {
|
|
|
$('#table-list-select tr').removeClass('table-success');
|
|
|
+ $('#code-list').html('');
|
|
|
});
|
|
|
|
|
|
// 清单选中和移除
|
|
|
- $('#table-list-select tr').on('click', function () {
|
|
|
- if ($(this).hasClass('table-success')) {
|
|
|
- $(this).removeClass('table-success');
|
|
|
- // 选中
|
|
|
- } else {
|
|
|
- $(this).addClass('table-success');
|
|
|
- // 移除
|
|
|
- }
|
|
|
+ $('body').on('click', '#table-list-select tr', function () {
|
|
|
+ const isCheck = $(this).hasClass('table-success') ? true : false;
|
|
|
+ const detail = $(this).attr('data-detail');
|
|
|
+ const isDeal = $(this).data('gcl') !== undefined ? true : false;
|
|
|
+ let codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox"></td></tr>';
|
|
|
+ if (isDeal) {
|
|
|
+ const gcl = gclGatherData[$(this).data('gcl')];
|
|
|
+ codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" ';
|
|
|
+ codeHtml += detail == 0 && isCheck ? 'checked' : '';
|
|
|
+ codeHtml += '></td></tr>';
|
|
|
+ for (const leaf of gcl.leafXmjs) {
|
|
|
+ const isChecked = detail == leaf.code + '_' + leaf.bwmx && isCheck ? 'checked' : '';
|
|
|
+ codeHtml += '<tr><td>' + leaf.code + '</td>' +
|
|
|
+ '<td>' + leaf.jldy + '</td>' +
|
|
|
+ '<td>' + leaf.bwmx + '</td>' +
|
|
|
+ '<td><input type="checkbox"' + isChecked +
|
|
|
+ '></td></tr>'
|
|
|
+ }
|
|
|
+ } else if (!isDeal && isCheck) {
|
|
|
+ codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" checked></td></tr>';
|
|
|
+ }
|
|
|
+ $('#code-list').attr('data-index', $(this).children('td').eq(0).text());
|
|
|
+ $('#code-list').html(codeHtml);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 右边项目节选择
|
|
|
+ $('body').on('click', '#code-list input', function () {
|
|
|
+ let index = $('#code-list').attr('data-index');
|
|
|
+ if ($(this).is(':checked')) {
|
|
|
+ // 去除其它可能已选的checked
|
|
|
+ $('#code-list input').prop('checked', false);
|
|
|
+ $(this).prop('checked', true);
|
|
|
+ // 左边表单传值并添加class
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').addClass('table-success');
|
|
|
+ // 判断是否选择了自行编辑变更详情
|
|
|
+ const tr = $(this).parents('tr');
|
|
|
+ const length = tr.children('td').length;
|
|
|
+ const detail = length === 4 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', detail);
|
|
|
+ } else {
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', '');
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 添加空白清单or签约清单
|
|
@@ -238,7 +308,6 @@ $(document).ready(() => {
|
|
|
const scnum = tr.children('td[data-site="7"]').children('input').val() != '-' ? tr.children('td[data-site="7"]').children('input').val() : '';
|
|
|
const detail = $.trim(tr.children('td[data-site="2"]').children('input').val());
|
|
|
const trlist = [code,name,unit,price,oamount,scnum,detail];
|
|
|
- console.log(code);
|
|
|
if (isWhite) {
|
|
|
let changelist = $('#change-whitelist').val().split('^_^');
|
|
|
trlist.push(0);
|
|
@@ -338,7 +407,7 @@ function maketablelist(status){
|
|
|
let numdecimal = findDecimal(unit);
|
|
|
|
|
|
let scnum = makedecimalzero(numdecimal);
|
|
|
- let detail = '';
|
|
|
+ let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
|
|
|
let lid = $(this).data('lid');
|
|
|
let trlist = [code, name, unit, price, oamount, scnum, detail, lid];
|
|
|
radionList.push(trlist.join(';'));
|