Ver código fonte

变更增加项目节编号和细目记录

laiguoran 5 anos atrás
pai
commit
92e97a262c

+ 4 - 2
app/controller/change_controller.js

@@ -343,13 +343,15 @@ module.exports = app => {
                             cl.camount,
                             cl.detail,
                             cl.lid,
+                            cl.xmj_code,
+                            cl.xmj_jldy,
                         ];
                         ototalCost += cl.unit_price === null ? 0 : ctx.helper.mul(cl.unit_price, cl.oamount, ctx.tender.info.decimal.tp);
                         ctotalCost += cl.unit_price === null ? 0 : ctx.helper.mul(cl.unit_price, cl.camount, ctx.tender.info.decimal.tp);
                         if (cl.lid !== '0') {
-                            changeListData.push(cLArray.join(';'));
+                            changeListData.push(cLArray.join('*;*'));
                         } else {
-                            changeWhiteListData.push(cLArray.join(';'));
+                            changeWhiteListData.push(cLArray.join('*;*'));
                         }
                     }
                     renderData.changeListData = changeListData.join('^_^');

+ 39 - 29
app/public/js/change_set.js

@@ -167,7 +167,7 @@ $(document).ready(() => {
                 }
                 changeList.push.apply(changeList, changeWhiteList);
                 for (const [index, cl] of changeList.entries()) {
-                    const clInfo = cl.split(';');
+                    const clInfo = cl.split('*;*');
                     // if (clInfo[0] === '' || clInfo[1] === '' || clInfo[3] === '' || clInfo[4] === '' || clInfo[5] === '') {
                     if (clInfo[0] === '' || clInfo[1] === '' || clInfo[5] === '') {
                         toastr.error('变更清单第' + (index+1) + '行未完整填写数据(变更部位、变更详情、单位、单价可空)');
@@ -363,7 +363,7 @@ $(document).ready(() => {
             for (const leaf of gcl.leafXmjs) {
                 const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
                 const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
-                const isChecked = data_bwmx.indexOf(leaf.code + '_' + (bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + ';' + quantity) !== -1 && isCheck ? 'checked' : '';
+                const isChecked = data_bwmx.indexOf(leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' + (bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ? 'checked' : '';
                 codeHtml += '<tr quantity="' + quantity + '"><td>' + leaf.code + '</td>' +
                     '<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
                     '<td>' + (leaf.dwgc ? leaf.dwgc : '') + '</td>' +
@@ -397,9 +397,9 @@ $(document).ready(() => {
             $('#code-list input:checked').each(function () {
                 const tr = $(this).parents('tr');
                 const length = tr.children('td').length;
-                const bwmx = length === 8 ? tr.children('td').eq(0).text() + '_' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
+                const bwmx = length === 8 ? tr.children('td').eq(0).text() + '!_!' + tr.children('td').eq(1).text() + '!_!' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
                 const quantity = tr.attr('quantity');
-                const de_qu = bwmx + ';' + quantity;
+                const de_qu = bwmx + '*;*' + quantity;
                 data_bwmx.push(de_qu);
             });
             data_bwmx = data_bwmx.join('$#$');
@@ -412,9 +412,9 @@ $(document).ready(() => {
                 $('#code-list input:checked').each(function () {
                     const tr = $(this).parents('tr');
                     const length = tr.children('td').length;
-                    const bwmx = length === 8 ? tr.children('td').eq(0).text() + '_' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
+                    const bwmx = length === 8 ? tr.children('td').eq(0).text() + '!_!'+ tr.children('td').eq(1).text() + '!_!' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
                     const quantity = tr.attr('quantity');
-                    const de_qu = bwmx + ';' + quantity;
+                    const de_qu = bwmx + '*;*' + quantity;
                     data_bwmx.push(de_qu);
                 });
                 data_bwmx = data_bwmx.join('$#$');
@@ -480,6 +480,8 @@ $(document).ready(() => {
     $('body').on('valuechange', '.clist input', function (e, previous) {
         const index = $(this).parents('tr').data('index');
         const lid = $(this).parents('tr').data('lid');
+        const xmj_code = $(this).parents('tr').data('xmjcode') || '';
+        const xmj_jldy = $(this).parents('tr').data('xmjjldy') || '';
         const isWhite = !isNaN(lid) ? true : false;
         const tr = $('#list tr[data-lid="' + lid + '"]').eq(0);
         const site = parseInt($(this).parents('td').data('site'));
@@ -508,12 +510,16 @@ $(document).ready(() => {
         if (isWhite) {
             let changelist = $('#change-whitelist').val().split('^_^');
             trlist.push(0);
-            changelist.splice(index, 1, trlist.join(';'));
+            trlist.push(xmj_code);
+            trlist.push(xmj_jldy);
+            changelist.splice(index, 1, trlist.join('*;*'));
             $('#change-whitelist').val(changelist.join('^_^'));
         } else {
             let changelist = $('#change-list').val().split('^_^');
             trlist.push(lid.split('_')[0]);
-            changelist.splice(index, 1, trlist.join(';'));
+            trlist.push(xmj_code);
+            trlist.push(xmj_jldy);
+            changelist.splice(index, 1, trlist.join('*;*'));
             $('#change-list').val(changelist.join('^_^'));
         }
         tr.children('td[data-site="7"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
@@ -543,9 +549,9 @@ $(document).ready(() => {
         tr.children('td[data-site="6"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
         tr.children('td[data-site="8"]').children('input').val(scnum);
         tr.children('td[data-site="8"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
-        const trlist = [code,name,bwmx,unit,price,oamount,scnum,detail,0];
+        const trlist = [code,name,bwmx,unit,price,oamount,scnum,detail,0,'',''];
         let changelist = $('#change-whitelist').val().split('^_^');
-        changelist.splice(index, 1, trlist.join(';'));
+        changelist.splice(index, 1, trlist.join('*;*'));
         $('#change-whitelist').val(changelist.join('^_^'));
         tr.children('td[data-site="7"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
         tr.children('td[data-site="9"]').text(price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),totalPriceUnit) : '');
@@ -635,7 +641,7 @@ function tableDataRemake(changeListData) {
     const changeList = $('#change-list').val().split('^_^');
     if (changeList.length > 0 && changeList[0]) {
         for (const [index,cl] of changeList.entries()) {
-            const clinfo = cl.split(';');
+            const clinfo = cl.split('*;*');
             // 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]);
@@ -653,21 +659,21 @@ function tableDataRemake(changeListData) {
                     continue;
                 }
                 $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
-                let pushbwmx = '0;0';
+                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 !== null ? item.quantity === parseFloat(clinfo[5]) : 0 === parseFloat(clinfo[5]));
                     });
                     console.log(leafInfo);
                     if (leafInfo) {
-                        pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
+                        pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
                     } else {
                         toastr.warning('台账清单列表已不存在'+ clinfo[0] +',已更新变更清单列表');
                         changeList.splice(index, 1);
                         continue;
                     }
                 } else {
-                    pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
+                    pushbwmx = '0*;*' + (listinfo.quantity !== null ? listinfo.quantity : 0);
                 }
                 const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
                 if (bwmx) {
@@ -679,20 +685,20 @@ function tableDataRemake(changeListData) {
                 }
             } else {
                 $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').addClass('table-success');
-                let pushbwmx = '0;0';
+                let pushbwmx = '0*;*0';
                 if (listinfo.leafXmjs !== undefined) {
                     const leafInfo = listinfo.leafXmjs.find(function (item) {
                         return (item.bwmx === undefined || item.bwmx === clinfo[2] || item.jldy === clinfo[2]) && (item.quantity !== null ? item.quantity === parseFloat(clinfo[5]) : 0 === parseFloat(clinfo[5]));
                     });
                     if (leafInfo) {
-                        pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy ? leafInfo.jldy : '')) + ';' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
+                        pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
                     } else {
                         toastr.warning('台账清单列表已不存在'+ clinfo[0] +',已更新变更清单列表');
                         changeList.splice(index, 1);
                         continue;
                     }
                 } else {
-                    pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
+                    pushbwmx = '0*;*' + (listinfo.quantity !== null ? listinfo.quantity : 0);
                 }
                 const bwmx = $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx');
                 if (bwmx) {
@@ -834,18 +840,20 @@ function maketablelist(status){
         // 原清单和数量改变
         let data_bwmx = $(this).attr('data-bwmx').split('$#$');
         for (const b of data_bwmx) {
-            const oamount = b.split(';')[1] != '' ? b.split(';')[1] : 0;
-            let bwmx = b.split(';')[0] != 0 ? b.split(';')[0].split('_')[1] : '';
-            let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid];
+            const oamount = b.split('*;*')[1] != '' ? b.split('*;*')[1] : 0;
+            let bwmx = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[2] : '';
+            let xmj_code = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[0] : '';
+            let xmj_jldy = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[1] : '';
+            let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid, xmj_code, xmj_jldy];
             const radionInfo = radionList.find(function (item) {
-                const info = item.split(';');
+                const info = item.split('*;*');
                 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];
+                trlist[6] = radionInfo.split('*;*')[6];
+                trlist[7] = radionInfo.split('*;*')[7];
             }
-            newTableList.push(trlist.join(';'));
+            newTableList.push(trlist.join('*;*'));
         }
     });
     // 排序
@@ -854,7 +862,7 @@ function maketablelist(status){
     let whiteIndex = 0;
     let deteletr = '<td><a class="text-danger">移除</a></td>';
     for (const radion of newTableList) {
-        const radionArray = radion.split(';');
+        const radionArray = radion.split('*;*');
         let code = radionArray[0];
         let name = radionArray[1];
         let bwmx = radionArray[2];
@@ -864,11 +872,13 @@ function maketablelist(status){
         let scnum = radionArray[6];
         let detail = radionArray[7];
         let lid = radionArray[8];
+        let xmj_code = radionArray[9];
+        let xmj_jldy = radionArray[10];
         let sctotal = scnum !== '' && scnum !== '-' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),decimal) : '';
 
         // 根据单位获取数量的位数,并得出
         let numdecimal = findDecimal(unit);
-        html += '<tr class="clist clid" data-lid="' + lid + '_' + index + '" data-index="' + index + '">' +
+        html += '<tr class="clist clid" data-lid="' + lid + '_' + index + '" data-index="' + index + '" data-xmjcode="'+ xmj_code +'" data-xmjjldy="'+ xmj_jldy +'">' +
             '<td data-site="0">'+ code +'</td>' +
             '<td data-site="1">'+ name +'</td>' +
             '<td data-site="2">'+ bwmx +'</td>' +
@@ -888,12 +898,12 @@ function maketablelist(status){
     let radionWhiteList = $('#change-whitelist').val() !== '' ? $('#change-whitelist').val().split('^_^') : [];
     //判断是否添加空白清单
     if(status == 'addwhite'){
-        let trlist = ['','','','','',makedecimalzero(findDecimal(3)),makedecimalzero(findDecimal(3)),'',0];
-        radionWhiteList.push(trlist.join(';'));
+        let trlist = ['','','','','',makedecimalzero(findDecimal(3)),makedecimalzero(findDecimal(3)),'',0, '', ''];
+        radionWhiteList.push(trlist.join('*;*'));
     }
 
     for (const rw of radionWhiteList) {
-        const radionArray = rw.split(';');
+        const radionArray = rw.split('*;*');
         let code = radionArray[0];
         let name = radionArray[1];
         let bwmx = radionArray[2];

+ 3 - 1
app/service/change.js

@@ -441,7 +441,7 @@ module.exports = app => {
                 let total_price = 0;
                 if (changeList.length > 0) {
                     for (const cl of changeList) {
-                        const clInfo = cl.split(';');
+                        const clInfo = cl.split('*;*');
                         const clArray = {
                             tid: tenderId,
                             cid: changeInfo.cid,
@@ -456,6 +456,8 @@ module.exports = app => {
                             samount: '',
                             detail: clInfo[7],
                             spamount: clInfo[6],
+                            xmj_code: clInfo[9] !== '' ? clInfo[9] : null,
+                            xmj_jldy: clInfo[10] !== '' ? clInfo[10] : null,
                         };
                         if (clInfo[4] === '') {
                             delete clArray.unit_price;