|
@@ -18,27 +18,29 @@ $(document).ready(() => {
|
|
|
let listHtml = '';
|
|
|
let list_index = 1;
|
|
|
for (const gcl of gclGatherData) {
|
|
|
+ const quantity = gcl.quantity !== undefined ? gcl.quantity : 0;
|
|
|
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, findDecimal(gcl.unit)) + '</td>' +
|
|
|
- '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
|
|
|
+ '<td>' + roundnum(quantity, findDecimal(gcl.unit)) + '</td>' +
|
|
|
+ // '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
|
|
|
'</tr>';
|
|
|
list_index++;
|
|
|
}
|
|
|
// 再加载签约清单
|
|
|
for (const db of dealBillList) {
|
|
|
+ const quantity = db.quantity !== undefined ? db.quantity : 0;
|
|
|
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>' +
|
|
|
+ '<td>' + roundnum(quantity, findDecimal(db.unit)) + '</td>' +
|
|
|
+ // '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
|
|
|
'</tr>';
|
|
|
list_index++;
|
|
|
}
|
|
@@ -142,6 +144,30 @@ $(document).ready(() => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ // 保存修改ajax提交(不刷新页面)
|
|
|
+ $('#save_change').on('click', function () {
|
|
|
+ // 保存修改modal
|
|
|
+ $('#changeStatus').val(2);
|
|
|
+ // 获取auditlist并填入input中
|
|
|
+ getAuditList();
|
|
|
+ if ($('input[name="code"]').val() === '') {
|
|
|
+ toastr.error('申请编号不能为空!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ($('input[name="name"]').val() === '') {
|
|
|
+ toastr.error('工程名称不能为空!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $('#change_form').ajaxSubmit(function (result) {
|
|
|
+ if ( result.err === 0) {
|
|
|
+ toastr.success(result.msg);
|
|
|
+ } else {
|
|
|
+ toastr.error(result.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
// 审批人分组选择
|
|
|
$('#account_group').change(function () {
|
|
|
let account_html = '<option value="0">选择审批人</option>';
|
|
@@ -228,24 +254,27 @@ $(document).ready(() => {
|
|
|
// 清单选中和移除
|
|
|
$('body').on('click', '#table-list-select tr', function () {
|
|
|
const isCheck = $(this).hasClass('table-success') ? true : false;
|
|
|
- const detail = $(this).attr('data-detail');
|
|
|
+ const data_detail = $(this).attr('data-detail').split('$#$');
|
|
|
const isDeal = $(this).data('gcl') !== undefined ? true : false;
|
|
|
- let codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox"></td></tr>';
|
|
|
+ let codeHtml = '<tr quantity="0"><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 = '<tr quantity="0"><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" ';
|
|
|
+ // 判断自行编辑变更详情是否已选中
|
|
|
+ codeHtml += data_detail.indexOf('0;0') !== -1 && 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>' +
|
|
|
+ const quantity = leaf.quantity !== undefined ? leaf.quantity : 0;
|
|
|
+ const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
|
|
|
+ const isChecked = data_detail.indexOf(leaf.code + '_' + bwmx + ';' + quantity) !== -1 && isCheck ? 'checked' : '';
|
|
|
+ codeHtml += '<tr quantity="' + quantity + '"><td>' + leaf.code + '</td>' +
|
|
|
'<td>' + leaf.jldy + '</td>' +
|
|
|
- '<td>' + leaf.bwmx + '</td>' +
|
|
|
+ '<td>' + bwmx + '</td>' +
|
|
|
'<td><input type="checkbox"' + isChecked +
|
|
|
- '></td></tr>'
|
|
|
+ '></td></tr>';
|
|
|
}
|
|
|
} else if (!isDeal && isCheck) {
|
|
|
- codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" checked></td></tr>';
|
|
|
+ codeHtml = '<tr quantity="0"><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);
|
|
@@ -256,18 +285,41 @@ $(document).ready(() => {
|
|
|
let index = $('#code-list').attr('data-index');
|
|
|
if ($(this).is(':checked')) {
|
|
|
// 去除其它可能已选的checked
|
|
|
- $('#code-list input').prop('checked', false);
|
|
|
+ // $('#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);
|
|
|
+ // 去除部分data-detail值
|
|
|
+ let data_detail = [];
|
|
|
+ $('#code-list input:checked').each(function () {
|
|
|
+ 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';
|
|
|
+ const quantity = tr.attr('quantity');
|
|
|
+ const de_qu = detail + ';' + quantity;
|
|
|
+ data_detail.push(de_qu);
|
|
|
+ });
|
|
|
+ data_detail = data_detail.join('$#$');
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', data_detail);
|
|
|
} else {
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', '');
|
|
|
+ // 判断还有无选中项目节编号
|
|
|
+ if ($('#code-list input').is(':checked')) {
|
|
|
+ // 去除部分data-detail值
|
|
|
+ let data_detail = [];
|
|
|
+ $('#code-list input:checked').each(function () {
|
|
|
+ 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';
|
|
|
+ const quantity = tr.attr('quantity');
|
|
|
+ const de_qu = detail + ';' + quantity;
|
|
|
+ data_detail.push(de_qu);
|
|
|
+ });
|
|
|
+ data_detail = data_detail.join('$#$');
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', data_detail);
|
|
|
+ } else {
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
|
|
|
+ $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', '');
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -426,16 +478,22 @@ function maketablelist(status){
|
|
|
let name = $(this).children('td').eq(2).text();
|
|
|
let unit = $(this).children('td').eq(3).text();
|
|
|
let price = $(this).children('td').eq(4).text();
|
|
|
- let oamount = $(this).children('td').eq(5).text();
|
|
|
+ // let oamount = $(this).children('td').eq(5).text();
|
|
|
|
|
|
// 根据单位获取数量的位数,并得出
|
|
|
let numdecimal = findDecimal(unit);
|
|
|
|
|
|
let scnum = makedecimalzero(numdecimal);
|
|
|
- let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
|
|
|
+ // 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(';'));
|
|
|
+ // 原清单和数量改变
|
|
|
+ let data_detail = $(this).attr('data-detail').split('$#$');
|
|
|
+ for (const d of data_detail) {
|
|
|
+ const oamount = d.split(';')[1];
|
|
|
+ let detail = d.split(';')[0] != 0 ? d.split(';')[0].split('_')[1] : '';
|
|
|
+ let trlist = [code, name, unit, price, oamount, scnum, detail, lid];
|
|
|
+ radionList.push(trlist.join(';'));
|
|
|
+ }
|
|
|
});
|
|
|
// 排序
|
|
|
radionList.sort();
|