|
@@ -67,8 +67,8 @@ $(document).ready(() => {
|
|
|
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="' + list_index + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
|
|
|
+ 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>' +
|
|
@@ -96,6 +96,7 @@ $(document).ready(() => {
|
|
|
// list_index++;
|
|
|
// }
|
|
|
$('#table-list-select').html(listHtml);
|
|
|
+ tableDataRemake(changeListData);
|
|
|
|
|
|
// 上报时按钮点击
|
|
|
$('a[data-target="#sub-ap"]').on('click', function () {
|
|
@@ -232,7 +233,7 @@ $(document).ready(() => {
|
|
|
if (!isObjEqual(changeInfo, back_changeInfo)) {
|
|
|
changeFormRemake();
|
|
|
}
|
|
|
- if ($('#change-list').val() !== $('#back-change-list').val() || $('#change-whitelist').val !== $('#back-change-whitelist').val()) {
|
|
|
+ if ($('#change-list').val() !== $('#back-change-list').val() || $('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
|
|
|
$('#change-list').val($('#back-change-list').val());
|
|
|
$('#change-whitelist').val($('#back-change-whitelist').val());
|
|
|
tableDataRemake(changeListData);
|
|
@@ -348,7 +349,7 @@ $(document).ready(() => {
|
|
|
|
|
|
// 打开签约清单modal并删除之前的操作
|
|
|
$('#open-list-modal').click(function () {
|
|
|
- tableDataRemake(changeListData);
|
|
|
+ // tableDataRemake(changeListData);
|
|
|
});
|
|
|
|
|
|
// 清单选中和移除
|
|
@@ -446,9 +447,10 @@ $(document).ready(() => {
|
|
|
|
|
|
// 取消选中清单
|
|
|
$('#cancel-list-btn').click(function () {
|
|
|
- $('#table-list-select tr').removeClass('table-success');
|
|
|
- $('#table-list-select tr').attr('data-bwmx', '');
|
|
|
- $('#code-list').html('');
|
|
|
+ // $('#table-list-select tr').removeClass('table-success');
|
|
|
+ // $('#table-list-select tr').attr('data-bwmx', '');
|
|
|
+ // $('#code-list').html('');
|
|
|
+ tableDataRemake(changeListData);
|
|
|
});
|
|
|
|
|
|
// 移除已选清单并重新编号
|
|
@@ -590,43 +592,69 @@ function tableDataRemake(changeListData) {
|
|
|
// 根据已添加的清单显示
|
|
|
const changeList = $('#change-list').val().split('^_^');
|
|
|
if (changeList.length > 0 && changeList[0]) {
|
|
|
- for (const cl of changeList) {
|
|
|
+ for (const [index,cl] of changeList.entries()) {
|
|
|
const clinfo = cl.split(';');
|
|
|
- console.log(clinfo);
|
|
|
- const listinfo = changeListData[clinfo[8] - 1];
|
|
|
- // const listinfo = changeListData.find(function (item) {
|
|
|
- // return item.b_code === clinfo[0] && item.name === clinfo[1] && item.unit_price === parseFloat(clinfo[4])
|
|
|
- // });
|
|
|
+ // const listinfo = changeListData[clinfo[8] - 1];
|
|
|
+ let listinfo = changeListData.find(function (item) {
|
|
|
+ return (item.id !== undefined && item.id == clinfo[8]) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && item.leafXmjs[0].gcl_id == clinfo[8]);
|
|
|
+ });
|
|
|
// if (listinfo === undefined) {
|
|
|
// toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
|
|
|
// continue;
|
|
|
// }
|
|
|
- console.log(listinfo);
|
|
|
- $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
|
|
|
- let pushbwmx = '0;0';
|
|
|
- if (listinfo.leafXmjs !== undefined) {
|
|
|
- const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
|
- return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
|
|
|
- });
|
|
|
- pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
|
|
|
- } else {
|
|
|
- pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
|
|
|
- }
|
|
|
- const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
|
|
|
- if (bwmx) {
|
|
|
- const bwmxArray = bwmx.split('$#$');
|
|
|
- bwmxArray.push(pushbwmx);
|
|
|
- $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
|
|
|
+ if (listinfo === undefined) {
|
|
|
+ // 针对旧数据获取清单信息
|
|
|
+ listinfo = changeListData[clinfo[8] - 1];
|
|
|
+ if (listinfo === undefined) {
|
|
|
+ toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
|
|
|
+ changeList.splice(index, 1);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
|
|
|
+ let pushbwmx = '0;0';
|
|
|
+ if (listinfo.leafXmjs !== undefined) {
|
|
|
+ const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
|
+ return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
|
|
|
+ });
|
|
|
+ pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
|
|
|
+ } else {
|
|
|
+ pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
|
|
|
+ }
|
|
|
+ const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
|
|
|
+ if (bwmx) {
|
|
|
+ const bwmxArray = bwmx.split('$#$');
|
|
|
+ bwmxArray.push(pushbwmx);
|
|
|
+ $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
|
|
|
+ } else {
|
|
|
+ $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
|
|
|
+ }
|
|
|
} else {
|
|
|
- $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
|
|
|
+ $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').addClass('table-success');
|
|
|
+ let pushbwmx = '0;0';
|
|
|
+ if (listinfo.leafXmjs !== undefined) {
|
|
|
+ const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
|
+ return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
|
|
|
+ });
|
|
|
+ pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
|
|
|
+ } else {
|
|
|
+ pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
|
|
|
+ }
|
|
|
+ const bwmx = $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx');
|
|
|
+ if (bwmx) {
|
|
|
+ const bwmxArray = bwmx.split('$#$');
|
|
|
+ bwmxArray.push(pushbwmx);
|
|
|
+ $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
|
|
|
+ } else {
|
|
|
+ $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ $('#change-list').val(changeList.join('^_^'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function changeFormRemake() {
|
|
|
changeInfo = Object.assign({}, back_changeInfo);
|
|
|
- console.log(changeInfo);
|
|
|
$('#change_form input[name="code"]').val(changeInfo.code);
|
|
|
$('#change_form input[name="name"]').val(changeInfo.name);
|
|
|
$('#change_form input[name="peg"]').val(changeInfo.peg);
|
|
@@ -696,11 +724,13 @@ function maketablelist(status){
|
|
|
// let oamount = $(this).children('td').eq(5).text();
|
|
|
|
|
|
// 根据单位获取数量的位数,并得出
|
|
|
- let numdecimal = findDecimal(unit);
|
|
|
+ // let numdecimal = findDecimal(unit);
|
|
|
|
|
|
- let scnum = makedecimalzero(numdecimal);
|
|
|
+ // let scnum = makedecimalzero(numdecimal);
|
|
|
+ let scnum = 0;
|
|
|
// let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
|
|
|
let lid = $(this).data('lid');
|
|
|
+ let lindex = $(this).data('index');
|
|
|
// 原清单和数量改变
|
|
|
let data_bwmx = $(this).attr('data-bwmx').split('$#$');
|
|
|
for (const b of data_bwmx) {
|
|
@@ -709,10 +739,11 @@ function maketablelist(status){
|
|
|
let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid];
|
|
|
const radionInfo = radionList.find(function (item) {
|
|
|
const info = item.split(';');
|
|
|
- return info[0] === code && parseInt(info[8]) === parseInt(lid) && info[2] === bwmx;
|
|
|
+ return info[0] === code && (info[8] == lid || parseInt(info[8]) === parseInt(lindex)) && info[2] === bwmx;
|
|
|
});
|
|
|
if (radionInfo) {
|
|
|
trlist[6] = radionInfo.split(';')[6];
|
|
|
+ trlist[7] = radionInfo.split(';')[7];
|
|
|
}
|
|
|
newTableList.push(trlist.join(';'));
|
|
|
}
|
|
@@ -865,7 +896,6 @@ function judgeChange() {
|
|
|
if ($('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
|
|
|
change = true;
|
|
|
}
|
|
|
- console.log(changeInfo, back_changeInfo);
|
|
|
if (!isObjEqual(changeInfo, back_changeInfo)) {
|
|
|
change = true;
|
|
|
}
|