|
@@ -46,7 +46,7 @@ $(document).ready(() => {
|
|
|
for (const ggd in gclGatherData) {
|
|
|
gclGatherData[ggd].code = gclGatherData[ggd].b_code;
|
|
|
}
|
|
|
- console.log(gclGatherData);
|
|
|
+ // console.log(gclGatherData);
|
|
|
// 数组去重
|
|
|
for (const db of gclGatherData) {
|
|
|
const exist_index = dealBillList.findIndex(function (item) {
|
|
@@ -323,9 +323,7 @@ $(document).ready(() => {
|
|
|
|
|
|
// 打开签约清单modal并删除之前的操作
|
|
|
$('#open-list-modal').click(function () {
|
|
|
- $('#table-list-select tr').removeClass('table-success');
|
|
|
- $('#table-list-select tr').attr('data-bwmx', '');
|
|
|
- $('#code-list').html('');
|
|
|
+ tableDataRemake(changeListData);
|
|
|
});
|
|
|
|
|
|
// 清单选中和移除
|
|
@@ -335,7 +333,7 @@ $(document).ready(() => {
|
|
|
const isCheck = $(this).hasClass('table-success') ? true : false;
|
|
|
const data_bwmx = $(this).attr('data-bwmx').split('$#$');
|
|
|
const isDeal = $(this).data('gcl') !== undefined ? true : false;
|
|
|
- let codeHtml = '<tr quantity="0"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox"></td></tr>';
|
|
|
+ let codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox"></td></tr>';
|
|
|
if (isDeal) {
|
|
|
const gcl = gclGatherData[$(this).data('gcl')];
|
|
|
codeHtml = '';
|
|
@@ -351,7 +349,7 @@ $(document).ready(() => {
|
|
|
'></td></tr>';
|
|
|
}
|
|
|
} else if (!isDeal && isCheck) {
|
|
|
- codeHtml = '<tr quantity="0"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox" checked></td></tr>';
|
|
|
+ codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox" checked></td></tr>';
|
|
|
}
|
|
|
$('#code-list').attr('data-index', $(this).children('td').eq(0).text());
|
|
|
$('#code-list').html(codeHtml);
|
|
@@ -443,6 +441,8 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ tableDataRemake(changeListData);
|
|
|
+
|
|
|
// 重新绘制table
|
|
|
maketablelist();
|
|
|
});
|
|
@@ -531,6 +531,39 @@ $(document).ready(() => {
|
|
|
|
|
|
});
|
|
|
|
|
|
+function tableDataRemake(changeListData) {
|
|
|
+ $('#table-list-select tr').removeClass('table-warning');
|
|
|
+ $('#table-list-select tr').removeClass('table-success');
|
|
|
+ $('#table-list-select tr').attr('data-bwmx', '');
|
|
|
+ $('#code-list').html('');
|
|
|
+ // 根据已添加的清单显示
|
|
|
+ const changeList = $('#change-list').val().split('^_^');
|
|
|
+ if (changeList.length > 0 && changeList[0]) {
|
|
|
+ for (const cl of changeList) {
|
|
|
+ const clinfo = cl.split(';');
|
|
|
+ const listinfo = changeListData[clinfo[8] - 1];
|
|
|
+ $('#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 === clinfo[2] && item.quantity === parseFloat(clinfo[5]);
|
|
|
+ });
|
|
|
+ pushbwmx = leafInfo.code + '_' + 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//判断元素是否在数组中,相当于php的in_array();
|
|
|
function in_array(arr, obj) {
|
|
|
let i = arr.length;
|
|
@@ -567,7 +600,8 @@ function maketablelist(status){
|
|
|
|
|
|
// 原有清单(不含空白清单)
|
|
|
let radionList = $('#change-list').val() !== '' ? $('#change-list').val().split('^_^') : [];
|
|
|
- // 获取选中的签约清单并插入到原有清单中
|
|
|
+ const newTableList = [];
|
|
|
+ // 获取选中的签约清单判断并插入到原有清单中
|
|
|
$('#table-list-select .table-success').each(function(){
|
|
|
let code = $(this).children('td').eq(1).text();
|
|
|
let name = $(this).children('td').eq(2).text();
|
|
@@ -587,15 +621,22 @@ function maketablelist(status){
|
|
|
const oamount = b.split(';')[1];
|
|
|
let bwmx = b.split(';')[0] != 0 ? b.split(';')[0].split('_')[1] : '';
|
|
|
let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid];
|
|
|
- radionList.push(trlist.join(';'));
|
|
|
+ const radionInfo = radionList.find(function (item) {
|
|
|
+ const info = item.split(';');
|
|
|
+ return info[0] === code && parseInt(info[8]) === parseInt(lid) && info[2] === bwmx;
|
|
|
+ });
|
|
|
+ if (radionInfo) {
|
|
|
+ trlist[6] = radionInfo.split(';')[6];
|
|
|
+ }
|
|
|
+ newTableList.push(trlist.join(';'));
|
|
|
}
|
|
|
});
|
|
|
// 排序
|
|
|
- radionList.sort();
|
|
|
+ // radionList.sort();
|
|
|
let index = 0;
|
|
|
let whiteIndex = 0;
|
|
|
let deteletr = '<td><a class="text-danger">移除</a></td>';
|
|
|
- for (const radion of radionList) {
|
|
|
+ for (const radion of newTableList) {
|
|
|
const radionArray = radion.split(';');
|
|
|
let code = radionArray[0];
|
|
|
let name = radionArray[1];
|
|
@@ -625,7 +666,7 @@ function maketablelist(status){
|
|
|
deteletr +'</tr>';
|
|
|
index ++;
|
|
|
}
|
|
|
- $('#change-list').val(radionList.join('^_^'));
|
|
|
+ $('#change-list').val(newTableList.join('^_^'));
|
|
|
|
|
|
|
|
|
let radionWhiteList = $('#change-whitelist').val() !== '' ? $('#change-whitelist').val().split('^_^') : [];
|
|
@@ -696,7 +737,7 @@ function maketablelist(status){
|
|
|
column.visible(!column.visible());
|
|
|
}
|
|
|
totalamount(decimal);
|
|
|
- $('#table-list-select tr').removeClass('table-success');
|
|
|
+ // $('#table-list-select tr').removeClass('table-success');
|
|
|
}
|
|
|
|
|
|
//统计合计金额
|