Jelajahi Sumber

变更部位明细选择修改

laiguoran 6 tahun lalu
induk
melakukan
e5f2957905

+ 1 - 0
app/controller/change_controller.js

@@ -327,6 +327,7 @@ module.exports = app => {
                         const cLArray = [
                             cl.code,
                             cl.name,
+                            cl.bwmx,
                             cl.unit,
                             cl.unit_price,
                             cl.oamount,

+ 6 - 1
app/public/js/change_approval.js

@@ -27,7 +27,7 @@ $(document).ready(() => {
         const amount = $(this).val();
         const lid = $(this).parents('tr').data('lid');
         const tr = $('#list tr[data-lid="' + lid + '"]').eq(0);
-        const unitprice = tr.children('td[data-site="4"]').text();
+        const unitprice = tr.children('td[data-site="5"]').text();
         tr.children('.amount_cost').text(amount != '' ?
             roundnum(parseFloat(unitprice).mul(parseFloat(amount)),totalPriceUnit) : '');
 
@@ -40,6 +40,11 @@ $(document).ready(() => {
         $('.amount_totalcost').eq(1).text(totalcost !== 0 ? roundnum(totalcost, totalPriceUnit) : '');
     });
 
+    // 选中input所有值
+    $('body').on('focus', ".clist input", function() {
+        $(this).select();
+    });
+
     // 审批提交与判断
     $('.approval-btn').on('click', function () {
         // 判断审批状态

+ 1 - 1
app/public/js/change_detail.js

@@ -107,7 +107,7 @@ $(document).ready(() => {
         if($(e.target).is('label')){
             return;
         }
-        let column = table.column(2);
+        let column = table.column(3);
         column.visible(!column.visible());
     })
 });

+ 87 - 80
app/public/js/change_set.js

@@ -20,7 +20,7 @@ $(document).ready(() => {
         const unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
         const quantity = gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? roundnum(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
         const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
-        listHtml += '<tr data-lid="' + list_index + '" data-gcl="' + (list_index-1) + '" data-index="' + list_index + '" data-detail="">' +
+        listHtml += '<tr data-lid="' + list_index + '" data-gcl="' + (list_index-1) + '" data-index="' + list_index + '" data-bwmx="">' +
             '<td>' + list_index + '</td>' +
             '<td>' + gcl.b_code + '</td>' +
             '<td>' + gcl.name + '</td>' +
@@ -36,7 +36,7 @@ $(document).ready(() => {
         const unit = db.unit !== undefined && db.unit !== null ? db.unit : '';
         const quantity = db.quantity !== null && db.quantity !== undefined ? (unit !== '' ? roundnum(db.quantity, findDecimal(db.unit)) : db.quantity) : 0;
         const unit_price = db.unit_price !== null && db.unit_price !== undefined ? db.unit_price : 0;
-        listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-detail="">' +
+        listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-bwmx="">' +
             '<td>' + list_index + '</td>' +
             '<td>' + db.code + '</td>' +
             '<td>' + db.name + '</td>' +
@@ -130,7 +130,7 @@ $(document).ready(() => {
                 for (const [index, cl] of changeList.entries()) {
                     const clInfo = cl.split(';');
                     if (clInfo[0] === '' || clInfo[1] === '' || clInfo[3] === '' || clInfo[4] === '' || clInfo[5] === '') {
-                        toastr.error('变更清单第' + (index+1) + '行未完整填写数据(变更详情可空)');
+                        toastr.error('变更清单第' + (index+1) + '行未完整填写数据(变更部位、变更详情可空)');
                         returnFlag = true;
                     }
                 }
@@ -257,7 +257,7 @@ $(document).ready(() => {
     // 清单选中和移除
     $('body').on('click', '#table-list-select tr', function () {
         const isCheck = $(this).hasClass('table-success') ? true : false;
-        const data_detail = $(this).attr('data-detail').split('$#$');
+        const data_bwmx = $(this).attr('data-bwmx').split('$#$');
         const isDeal = $(this).data('gcl') !== undefined ? true : false;
         let codeHtml = '<tr quantity="0"><td colspan="4"></td><td><input type="checkbox"></td></tr>';
         if (isDeal) {
@@ -266,7 +266,7 @@ $(document).ready(() => {
             for (const leaf of gcl.leafXmjs) {
                 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' : '';
+                const isChecked = data_bwmx.indexOf(leaf.code + '_' + bwmx + ';' + quantity) !== -1 && isCheck ? 'checked' : '';
                 codeHtml += '<tr quantity="' + quantity + '"><td>' + leaf.code + '</td>' +
                     '<td>' + leaf.jldy + '</td>' +
                     '<td>' + bwmx + '</td>' +
@@ -291,35 +291,35 @@ $(document).ready(() => {
             // 左边表单传值并添加class
             $('#table-list-select tr[data-index="' + index + '"]').addClass('table-success');
             // 去除部分data-detail值
-            let data_detail = [];
+            let data_bwmx = [];
             $('#code-list input:checked').each(function () {
                 const tr = $(this).parents('tr');
                 const length = tr.children('td').length;
-                const detail = length === 5 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
+                const bwmx = length === 5 ? 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);
+                const de_qu = bwmx + ';' + quantity;
+                data_bwmx.push(de_qu);
             });
-            data_detail = data_detail.join('$#$');
-            $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', data_detail);
+            data_bwmx = data_bwmx.join('$#$');
+            $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', data_bwmx);
         } else {
             // 判断还有无选中项目节编号
             if ($('#code-list input').is(':checked')) {
                 // 去除部分data-detail值
-                let data_detail = [];
+                let data_bwmx = [];
                 $('#code-list input:checked').each(function () {
                     const tr = $(this).parents('tr');
                     const length = tr.children('td').length;
-                    const detail = length === 5 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
+                    const bwmx = length === 5 ? 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);
+                    const de_qu = bwmx + ';' + quantity;
+                    data_bwmx.push(de_qu);
                 });
-                data_detail = data_detail.join('$#$');
-                $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', data_detail);
+                data_bwmx = data_bwmx.join('$#$');
+                $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', data_bwmx);
             } else {
                 $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
-                $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', '');
+                $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', '');
             }
         }
     });
@@ -375,22 +375,24 @@ $(document).ready(() => {
             case 0:
             case 1:
             case 2:
-            case 4:
+            case 3:
+            case 5:
                 tr.children('td[data-site="' + site + '"]').children('input').val($(this).val());
                 break;
-            case 5:
-            case 7:
+            case 6:
+            case 8:
             default:
                 break;
         }
         const code = $.trim(tr.children('td[data-site="0"]').children('input').val()) || $.trim(tr.children('td[data-site="0"]').text());
         const name = $.trim(tr.children('td[data-site="1"]').children('input').val()) || $.trim(tr.children('td[data-site="1"]').text());
-        const unit = $.trim(tr.children('td[data-site="3"]').children('select').val()) || $.trim(tr.children('td[data-site="3"]').text());
-        const price = (tr.children('td[data-site="4"]').children('input').val() != '-' ? tr.children('td[data-site="4"]').children('input').val() : '') || tr.children('td[data-site="4"]').text();
-        const oamount = (tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '') || tr.children('td[data-site="5"]').text();
-        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];
+        const bwmx = $.trim(tr.children('td[data-site="2"]').children('input').val()) || $.trim(tr.children('td[data-site="2"]').text());
+        const unit = $.trim(tr.children('td[data-site="4"]').children('select').val()) || $.trim(tr.children('td[data-site="4"]').text());
+        const price = (tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '') || tr.children('td[data-site="5"]').text();
+        const oamount = (tr.children('td[data-site="6"]').children('input').val() != '-' ? tr.children('td[data-site="6"]').children('input').val() : '') || tr.children('td[data-site="6"]').text();
+        const scnum = tr.children('td[data-site="8"]').children('input').val() != '-' ? tr.children('td[data-site="8"]').children('input').val() : '';
+        const detail = $.trim(tr.children('td[data-site="3"]').children('input').val());
+        const trlist = [code,name,bwmx,unit,price,oamount,scnum,detail];
         if (isWhite) {
             let changelist = $('#change-whitelist').val().split('^_^');
             trlist.push(0);
@@ -402,8 +404,8 @@ $(document).ready(() => {
             changelist.splice(index, 1, trlist.join(';'));
             $('#change-list').val(changelist.join('^_^'));
         }
-        tr.children('td[data-site="6"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
-        tr.children('td[data-site="8"]').text(price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),totalPriceUnit) : '');
+        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) : '');
         totalamount(totalPriceUnit);
     });
 
@@ -413,26 +415,27 @@ $(document).ready(() => {
         const tr = $('#list tr[data-lid="' + index + '"]');
         const code = $.trim(tr.children('td[data-site="0"]').children('input').val());
         const name = $.trim(tr.children('td[data-site="1"]').children('input').val());
+        const bwmx = $.trim(tr.children('td[data-site="2"]').children('input').val());
         const unit = $(this).val();
-        const price = tr.children('td[data-site="4"]').children('input').val() != '-' ? tr.children('td[data-site="4"]').children('input').val() : '';
-        let oamount = tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '';
-        let 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 price = tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '';
+        let oamount = tr.children('td[data-site="6"]').children('input').val() != '-' ? tr.children('td[data-site="6"]').children('input').val() : '';
+        let scnum = tr.children('td[data-site="8"]').children('input').val() != '-' ? tr.children('td[data-site="8"]').children('input').val() : '';
+        const detail = $.trim(tr.children('td[data-site="3"]').children('input').val());
 
         // 根据单位更新数量位数和合计
         const numdecimal = findDecimal(unit);
         oamount = roundnum(oamount, numdecimal);
         scnum = roundnum(scnum, numdecimal);
-        tr.children('td[data-site="5"]').children('input').val(oamount);
-        tr.children('td[data-site="5"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
-        tr.children('td[data-site="7"]').children('input').val(scnum);
-        tr.children('td[data-site="7"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
-        const trlist = [code,name,unit,price,oamount,scnum,detail,0];
+        tr.children('td[data-site="6"]').children('input').val(oamount);
+        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];
         let changelist = $('#change-whitelist').val().split('^_^');
         changelist.splice(index, 1, trlist.join(';'));
         $('#change-whitelist').val(changelist.join('^_^'));
-        tr.children('td[data-site="6"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
-        tr.children('td[data-site="8"]').text(price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),totalPriceUnit) : '');
+        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) : '');
         totalamount(totalPriceUnit);
     });
 
@@ -495,11 +498,11 @@ function maketablelist(status){
         // let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
         let lid = $(this).data('lid');
         // 原清单和数量改变
-        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];
+        let data_bwmx = $(this).attr('data-bwmx').split('$#$');
+        for (const b of data_bwmx) {
+            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(';'));
         }
     });
@@ -512,12 +515,13 @@ function maketablelist(status){
         const radionArray = radion.split(';');
         let code = radionArray[0];
         let name = radionArray[1];
-        let unit = radionArray[2];
-        let price = radionArray[3];
-        let oamount = radionArray[4];
-        let scnum = radionArray[5];
-        let detail = radionArray[6];
-        let lid = radionArray[7];
+        let bwmx = radionArray[2];
+        let unit = radionArray[3];
+        let price = radionArray[4];
+        let oamount = radionArray[5];
+        let scnum = radionArray[6];
+        let detail = radionArray[7];
+        let lid = radionArray[8];
         let sctotal = scnum !== '' && scnum !== '-' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),decimal) : '';
 
         // 根据单位获取数量的位数,并得出
@@ -526,13 +530,14 @@ function maketablelist(status){
         html += '<tr class="clist clid" data-lid="' + lid + '_' + index + '" data-index="' + index + '">' +
             '<td data-site="0">'+ code +'</td>' +
             '<td data-site="1">'+ name +'</td>' +
-            '<td data-site="2"><input class="form-control input-sm" type="text" placeholder="变更详情" value="' + detail + '"></td>' +
-            '<td data-site="3">'+ unit +'</td>' +
-            '<td data-site="4">'+ roundnum(price, updecimal) +'</td>' +
-            '<td data-site="5">'+ roundnum(oamount, numdecimal) +'</td>' +
-            '<td data-site="6">'+ roundnum(parseFloat(price).mul(parseFloat(oamount)),decimal) +'</td>' +
-            '<td data-site="7"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" placeholder="请输入变更数量" value="'+ (scnum != '-' ? roundnum(scnum, numdecimal) : '') +'"></td>' +
-            '<td data-site="8">'+ sctotal +'</td>'+
+            '<td data-site="2">'+ bwmx +'</td>' +
+            '<td data-site="3"><input class="form-control input-sm" type="text" placeholder="变更详情" value="' + detail + '"></td>' +
+            '<td data-site="4">'+ unit +'</td>' +
+            '<td data-site="5">'+ roundnum(price, updecimal) +'</td>' +
+            '<td data-site="6">'+ roundnum(oamount, numdecimal) +'</td>' +
+            '<td data-site="7">'+ roundnum(parseFloat(price).mul(parseFloat(oamount)),decimal) +'</td>' +
+            '<td data-site="8"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" placeholder="请输入变更数量" value="'+ (scnum != '-' ? roundnum(scnum, numdecimal) : '') +'"></td>' +
+            '<td data-site="9">'+ sctotal +'</td>'+
             deteletr +'</tr>';
         index ++;
     }
@@ -542,7 +547,7 @@ function maketablelist(status){
     let radionWhiteList = $('#change-whitelist').val() !== '' ? $('#change-whitelist').val().split('^_^') : [];
     //判断是否添加空白清单
     if(status == 'addwhite'){
-        let trlist = ['','',changeUnits.m.unit,makedecimalzero(decimal),makedecimalzero(findDecimal(changeUnits.m.unit)),makedecimalzero(findDecimal(changeUnits.m.unit)),'',0];
+        let trlist = ['','','',changeUnits.m.unit,makedecimalzero(decimal),makedecimalzero(findDecimal(changeUnits.m.unit)),makedecimalzero(findDecimal(changeUnits.m.unit)),'',0];
         radionWhiteList.push(trlist.join(';'));
     }
 
@@ -550,11 +555,12 @@ function maketablelist(status){
         const radionArray = rw.split(';');
         let code = radionArray[0];
         let name = radionArray[1];
-        let unit = radionArray[2];
-        let price = radionArray[3];
-        let oamount = radionArray[4];
-        let scnum = radionArray[5];
-        let detail = radionArray[6];
+        let bwmx = radionArray[2];
+        let unit = radionArray[3];
+        let price = radionArray[4];
+        let oamount = radionArray[5];
+        let scnum = radionArray[6];
+        let detail = radionArray[7];
         let ototal = price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),decimal) : '';
         let sctotal = price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),decimal) : '';
 
@@ -571,15 +577,16 @@ function maketablelist(status){
         let numdecimal = findDecimal(unit);
 
         html += '<tr class="clist" data-lid="' + whiteIndex + '" data-index="' + whiteIndex + '">' +
-            '<td data-site="0"><input class="form-control input-sm" type="text" value="'+ code +'" placeholder="请输入清单编号"></td>' +
-            '<td data-site="1"><input class="form-control input-sm" type="text" value="'+ name +'" placeholder="请输入名称"></td>' +
-            '<td data-site="2"><input class="form-control input-sm" type="text" value="'+ detail +'" placeholder="变更详情"></td>' +
-            '<td data-site="3"><select class="form-control input-sm">'+ optionlist +'</select></td>' +
-            '<td data-site="4"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ updecimal +')" value="'+ roundnum(price, updecimal) +'" placeholder="请输入单价"></td>' +
-            '<td data-site="5"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(oamount, numdecimal) +'" placeholder="请输入数量"></td>' +
-            '<td data-site="6">'+ ototal +'</td>' +
-            '<td data-site="7"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(scnum, numdecimal) +'" placeholder="请输入变更数量"></td>' +
-            '<td data-site="8">'+ sctotal +'</td>'+
+            '<td data-site="0"><input class="form-control input-sm" type="text" value="'+ code +'" placeholder="清单编号"></td>' +
+            '<td data-site="1"><input class="form-control input-sm" type="text" value="'+ name +'" placeholder="名称"></td>' +
+            '<td data-site="2"><input class="form-control input-sm" type="text" value="'+ bwmx +'" placeholder="变更部位"></td>' +
+            '<td data-site="3"><input class="form-control input-sm" type="text" value="'+ detail +'" placeholder="变更详情"></td>' +
+            '<td data-site="4"><select class="form-control input-sm">'+ optionlist +'</select></td>' +
+            '<td data-site="5"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ updecimal +')" value="'+ roundnum(price, updecimal) +'" placeholder="请输入单价"></td>' +
+            '<td data-site="6"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(oamount, numdecimal) +'" placeholder="请输入数量"></td>' +
+            '<td data-site="7">'+ ototal +'</td>' +
+            '<td data-site="8"><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(scnum, numdecimal) +'" placeholder="请输入变更数量"></td>' +
+            '<td data-site="9">'+ sctotal +'</td>'+
             deteletr +'</tr>';
         whiteIndex ++;
     }
@@ -591,18 +598,18 @@ function maketablelist(status){
     table = $('#tablelist').removeAttr('width').DataTable({
         columnDefs: [
             { className: 'allwidth1', width: 100, targets: 0 },
-            { className: 'allwidth2', width: 150, targets: [1,2] },
-            { className: 'allwidth4', width: 40, targets: 9 },
-            { className: 'allwidth5', width: 60, targets: 3 },
+            { className: 'allwidth2', width: 150, targets: [1,2,3] },
+            { className: 'allwidth4', width: 40, targets: 10 },
+            { className: 'allwidth5', width: 60, targets: 4 },
             { className: 'allwidth3',width: 80, targets: '_all' }
         ],
         fixedColumns: {
-            leftColumns: 5
+            leftColumns: 6
         }
     });
     // 判断是否显示变更详情
     if (!$('.change-detail-checkbox').is(':checked')) {
-        const column = table.column(2);
+        const column = table.column(3);
         column.visible(!column.visible());
     }
     totalamount(decimal);
@@ -615,9 +622,9 @@ function totalamount(decimal){
     let ctotalnum = 0;
     let ototalnum = 0;
     $('.clist').each(function(){
-        let ctotal = $(this).children('td[data-site="8"]').text();
+        let ctotal = $(this).children('td[data-site="9"]').text();
         ctotalnum = ctotal != '' ? parseFloat(ctotalnum).add(parseFloat(ctotal)) : parseFloat(ctotalnum);
-        let ototal = $(this).children('td[data-site="6"]').text();
+        let ototal = $(this).children('td[data-site="7"]').text();
         ototalnum = ototal != '' ? parseFloat(ototalnum).add(parseFloat(ototal)) : parseFloat(ototalnum);
     });
     $('.ctatalamount').eq(1).text(ctotalnum != 0 ? roundnum(ctotalnum,decimal) : zero);

+ 1 - 1
app/public/js/change_show.js

@@ -25,7 +25,7 @@ $(document).ready(() => {
         }
         // 判断是否显示变更详情
         if (!$('.change-detail-checkbox').is(':checked')) {
-            const column = table.column(2);
+            const column = table.column(3);
             column.visible(!column.visible());
         }
     })

+ 7 - 6
app/service/change.js

@@ -341,15 +341,16 @@ module.exports = app => {
                         const clArray = {
                             tid: tenderId,
                             cid: changeInfo.cid,
-                            lid: clInfo[7],
+                            lid: clInfo[8],
                             code: clInfo[0],
                             name: clInfo[1],
-                            unit: clInfo[2],
-                            unit_price: clInfo[3],
-                            oamount: clInfo[4],
-                            camount: clInfo[5],
+                            bwmx: clInfo[2],
+                            unit: clInfo[3],
+                            unit_price: clInfo[4],
+                            oamount: clInfo[5],
+                            camount: clInfo[6],
                             samount: '',
-                            detail: clInfo[6],
+                            detail: clInfo[7],
                         };
                         insertCL.push(clArray);
                         total_price = this.ctx.helper.accAdd(total_price, this.ctx.helper.accMul(clArray.unit_price, clArray.camount));

+ 38 - 29
app/view/change/info.ejs

@@ -406,6 +406,7 @@
                 <tr>
                     <th rowspan="2" class="text-center">清单编号</th>
                     <th rowspan="2" class="text-center">名称</th>
+                    <th rowspan="2" class="text-center">变更部位</th>
                     <th rowspan="2" class="text-center">变更详情</th>
                     <th rowspan="2" class="text-center">单位</th>
                     <th rowspan="2" class="text-center">单价</th>
@@ -427,13 +428,14 @@
                     <tr class="clist clid" data-lid="<%= cl.lid %>_<%= index %>" data-index="<%= index %>">
                         <td data-site="0"><%= cl.code %></td>
                         <td data-site="1"><%= cl.name %></td>
-                        <td data-site="2"><input class="form-control form-control-sm" placeholder="变更详情" type="text" value="<%= cl.detail %>"></td>
-                        <td data-site="3"><%= cl.unit %></td>
-                        <td data-site="4"><%= ctx.helper.roundNum(cl.unit_price, tpUnit) %></td>
-                        <td data-site="5"><%= ctx.helper.roundNum(cl.oamount, ctx.helper.findDecimal(cl.unit)) %></td>
-                        <td data-site="6"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), tpUnit) %></td>
-                        <td data-site="7"><input class="form-control form-control-sm" placeholder="变更数量" type="text" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)"  value="<%= ctx.helper.roundNum(cl.camount, ctx.helper.findDecimal(cl.unit)) %>"></td>
-                        <td data-site="8"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), tpUnit) %></td>
+                        <td data-site="2"><%= cl.bwmx %></td>
+                        <td data-site="3"><input class="form-control form-control-sm" placeholder="变更详情" type="text" value="<%= cl.detail %>"></td>
+                        <td data-site="4"><%= cl.unit %></td>
+                        <td data-site="5"><%= ctx.helper.roundNum(cl.unit_price, tpUnit) %></td>
+                        <td data-site="6"><%= ctx.helper.roundNum(cl.oamount, ctx.helper.findDecimal(cl.unit)) %></td>
+                        <td data-site="7"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), tpUnit) %></td>
+                        <td data-site="8"><input class="form-control form-control-sm" placeholder="变更数量" type="text" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)"  value="<%= ctx.helper.roundNum(cl.camount, ctx.helper.findDecimal(cl.unit)) %>"></td>
+                        <td data-site="9"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), tpUnit) %></td>
                         <td><a class="text-danger">移除</a>
                         </td>
                     </tr>
@@ -441,8 +443,9 @@
                     <tr class="clist" data-lid="<%= windex %>" data-index="<%= windex %>">
                         <td data-site="0"><input class="form-control form-control-sm" placeholder="清单编号" type="text" value="<%= cl.code %>"></td>
                         <td data-site="1"><input class="form-control form-control-sm" placeholder="名称" type="text" value="<%= cl.name %>"></td>
-                        <td data-site="2"><input class="form-control form-control-sm" placeholder="变更详情" type="text" value="<%= cl.detail %>"></td>
-                        <td data-site="3">
+                        <td data-site="2"><input class="form-control form-control-sm" placeholder="变更部位" type="text" value="<%= cl.bwmx %>"></td>
+                        <td data-site="3"><input class="form-control form-control-sm" placeholder="变更详情" type="text" value="<%= cl.detail %>"></td>
+                        <td data-site="4">
                             <select class="form-control input-sm">
                                 <% for (const j in changeUnits) { %>
                                     <% if (changeUnits[j].unit !== undefined && changeUnits[j].unit === cl.unit) { %>
@@ -453,11 +456,11 @@
                                 <% } %>
                             </select>
                         </td>
-                        <td data-site="4"><input class="form-control form-control-sm" placeholder="单价" onkeyup="RegNum(this,event,upUnit)" type="text" value="<%= ctx.helper.roundNum(cl.unit_price, upUnit) %>"></td>
-                        <td data-site="5"><input class="form-control form-control-sm" placeholder="数量" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)" type="text" value="<%= ctx.helper.roundNum(cl.oamount, ctx.helper.findDecimal(cl.unit)) %>"></td>
-                        <td data-site="6"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), tpUnit) %></td>
-                        <td data-site="7"><input class="form-control form-control-sm" placeholder="变更数量" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)" type="text" value="<%= ctx.helper.roundNum(cl.camount, ctx.helper.findDecimal(cl.unit)) %>"></td>
-                        <td data-site="8"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), tpUnit) %></td>
+                        <td data-site="5"><input class="form-control form-control-sm" placeholder="单价" onkeyup="RegNum(this,event,upUnit)" type="text" value="<%= ctx.helper.roundNum(cl.unit_price, upUnit) %>"></td>
+                        <td data-site="6"><input class="form-control form-control-sm" placeholder="数量" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)" type="text" value="<%= ctx.helper.roundNum(cl.oamount, ctx.helper.findDecimal(cl.unit)) %>"></td>
+                        <td data-site="7"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), tpUnit) %></td>
+                        <td data-site="8"><input class="form-control form-control-sm" placeholder="变更数量" onkeyup="RegNum(this,event,<%= ctx.helper.findDecimal(cl.unit) %>)" type="text" value="<%= ctx.helper.roundNum(cl.camount, ctx.helper.findDecimal(cl.unit)) %>"></td>
+                        <td data-site="9"><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), tpUnit) %></td>
                         <td><a class="text-danger">移除</a>
                         </td>
                     </tr>
@@ -467,7 +470,7 @@
                 </tbody>
                 <tfoot>
                 <tr class="info">
-                    <td>合计</td><td></td><td></td><td></td><td></td><td></td>
+                    <td>合计</td><td></td><td></td><td></td><td></td><td></td><td></td>
                     <td class="otatalamount"><%= ctx.helper.roundNum(ototalCost, tpUnit) %></td><td></td>
                     <td class="ctatalamount"><%= ctx.helper.roundNum(ctotalCost, tpUnit) %></td><td></td>
                 </tr>
@@ -479,6 +482,7 @@
                     <tr>
                         <th rowspan="2" class="text-center">清单编号</th>
                         <th rowspan="2" class="text-center">名称</th>
+                        <th rowspan="2" class="text-center">变更部位</th>
                         <th rowspan="2" class="text-center">变更详情</th>
                         <th rowspan="2" class="text-center">单位</th>
                         <th rowspan="2" class="text-center">单价</th>
@@ -500,6 +504,7 @@
                         <tr>
                             <td><%= cl.code %></td>
                             <td><%= cl.name %></td>
+                            <td><%= cl.bwmx %></td>
                             <td><%= cl.detail %></td>
                             <td><%= cl.unit %></td>
                             <td><%= ctx.helper.roundNum(cl.unit_price, upUnit) %></td>
@@ -515,7 +520,7 @@
                     </tbody>
                     <tfoot>
                     <tr class="info">
-                        <td>合计</td><td></td><td></td><td></td><td></td><td></td>
+                        <td>合计</td><td></td><td></td><td></td><td></td><td></td><td></td>
                         <td><%= ctx.helper.roundNum(ototalCost, tpUnit) %></td><td></td>
                         <td><%= ctx.helper.roundNum(ctotalCost, tpUnit) %></td><td></td>
                         <td><%= stotalCost !== 0 ? ctx.helper.roundNum(stotalCost, tpUnit) : '' %></td>
@@ -528,6 +533,7 @@
                     <tr>
                         <th rowspan="2" class="text-center">清单编号</th>
                         <th rowspan="2" class="text-center">名称</th>
+                        <th rowspan="2" class="text-center">变更部位</th>
                         <th rowspan="2" class="text-center">变更详情</th>
                         <th rowspan="2" class="text-center">单位</th>
                         <th rowspan="2" class="text-center">单价</th>
@@ -558,6 +564,7 @@
                         <tr>
                             <td><%= cl.code %></td>
                             <td><%= cl.name %></td>
+                            <td><%= cl.bwmx %></td>
                             <td><%= cl.detail %></td>
                             <td><%= cl.unit %></td>
                             <td><%= ctx.helper.roundNum(cl.unit_price, upUnit) %></td>
@@ -577,7 +584,7 @@
                     </tbody>
                     <tfoot>
                     <tr class="info">
-                        <td>合计</td><td></td><td></td><td></td><td></td><td></td>
+                        <td>合计</td><td></td><td></td><td></td><td></td><td></td><td></td>
                         <td><%= ctx.helper.roundNum(ototalCost, tpUnit) %></td><td></td>
                         <td><%= ctx.helper.roundNum(ctotalCost, tpUnit) %></td>
                         <% for (const audit of auditList2) { %>
@@ -594,6 +601,7 @@
                     <tr>
                         <th rowspan="2" class="text-center">清单编号</th>
                         <th rowspan="2" class="text-center">名称</th>
+                        <th rowspan="2" class="text-center">变更部位</th>
                         <th rowspan="2" class="text-center">变更详情</th>
                         <th rowspan="2" class="text-center">单位</th>
                         <th rowspan="2" class="text-center">单价</th>
@@ -624,9 +632,10 @@
                         <tr class="clist" data-lid="<%= cl.id %>">
                             <td><%= cl.code %></td>
                             <td><%= cl.name %></td>
+                            <td><%= cl.bwmx %></td>
                             <td><%= cl.detail %></td>
                             <td><%= cl.unit %></td>
-                            <td data-site="4"><%= ctx.helper.roundNum(cl.unit_price, upUnit) %></td>
+                            <td data-site="5"><%= ctx.helper.roundNum(cl.unit_price, upUnit) %></td>
                             <td><%= ctx.helper.roundNum(cl.oamount, ctx.helper.findDecimal(cl.unit)) %></td>
                             <td><%= ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), tpUnit) %></td>
                             <td><%= ctx.helper.roundNum(cl.camount, ctx.helper.findDecimal(cl.unit)) %></td>
@@ -652,7 +661,7 @@
                     </tbody>
                     <tfoot>
                     <tr class="info">
-                        <td>合计</td><td></td><td></td><td></td><td></td><td></td>
+                        <td>合计</td><td></td><td></td><td></td><td></td><td></td><td></td>
                         <td><%= ctx.helper.roundNum(ototalCost, tpUnit) %></td><td></td>
                         <td><%= ctx.helper.roundNum(ctotalCost, tpUnit) %></td>
                         <% for (const audit of auditList) { %>
@@ -738,13 +747,13 @@
     const billsTable = {
         columnDefs: [
             { className: 'allwidth1', width: 100, targets: 0 },
-            { className: 'allwidth2', width: 150, targets: [1,2] },
-            { className: 'allwidth4', width: 40, targets: 9 },
-            { className: 'allwidth5', width: 60, targets: 3 },
+            { className: 'allwidth2', width: 150, targets: [1,2,3] },
+            { className: 'allwidth4', width: 40, targets: 10 },
+            { className: 'allwidth5', width: 60, targets: 4 },
             { className: 'allwidth3',width: 80, targets: '_all' }
         ],
         fixedColumns: {
-            leftColumns: 5
+            leftColumns: 6
         }
     }
     const ledger = JSON.parse('<%- JSON.stringify(ledger) %>');
@@ -760,12 +769,12 @@
     const billsTable = {
         columnDefs: [
             { className: 'allwidth1', width: 100, targets: 0 },
-            { className: 'allwidth2', width: 150, targets: [1,2] },
-            { className: 'allwidth5', width: 60, targets: 3 },
+            { className: 'allwidth2', width: 150, targets: [1,2,3] },
+            { className: 'allwidth5', width: 60, targets: 4 },
             { className: 'allwidth3',width: 80, targets: '_all' }
         ],
         fixedColumns: {
-            leftColumns: 5
+            leftColumns: 6
         }
     }
 </script>
@@ -775,12 +784,12 @@
     const billsTable = {
         columnDefs: [
             { className: 'allwidth1', width: 100, targets: 0 },
-            { className: 'allwidth2', width: 150, targets: [1,2] },
-            { className: 'allwidth5', width: 60, targets: 3 },
+            { className: 'allwidth2', width: 150, targets: [1,2,3] },
+            { className: 'allwidth5', width: 60, targets: 4 },
             { className: 'allwidth3',width: 80, targets: '_all' }
         ],
         fixedColumns: {
-            leftColumns: 5
+            leftColumns: 6
         }
     }
 </script>