Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 3 years ago
parent
commit
39a545d1d8

+ 12 - 0
app/controller/tender_controller.js

@@ -1407,6 +1407,17 @@ module.exports = app => {
                                 orders: [['in_time', 'desc']],
                             });
                             break;
+                        case 'advance':
+                            const advance = await ctx.service.advance.getAllDataByCondition({
+                                columns: [ 'id', 'order', 'status', 'selected' ],
+                                where,
+                                orders: [['create_time', 'desc']],
+                            });
+                            advance.forEach(x => {
+                                x.statusStr = auditConst.advance.statusString[x.status];
+                            });
+                            responseData.data[f] = advance;
+                            break;
                         default:
                             throw '未知数据类型';
                     }
@@ -1426,6 +1437,7 @@ module.exports = app => {
                 if (data.change_apply) await this.ctx.service.changeApply.defaultUpdateRows(data.change_apply);
                 if (data.change_project) await this.ctx.service.changeProject.defaultUpdateRows(data.change_project);
                 if (data.change_plan) await this.ctx.service.changePlan.defaultUpdateRows(data.change_plan);
+                if (data.advance) await this.ctx.service.advance.defaultUpdateRows(data.advance);
                 ctx.body = responseData;
             } catch (err) {
                 ctx.log(err);

+ 0 - 1
app/lib/rpt_data_analysis.js

@@ -1834,7 +1834,6 @@ const gatherMaterialGl = {
                 gd.quantity = ctx.helper.add(gd.quantity, d.quantity);
             }
         }
-        console.log(result);
         data.mem_material_gl_detail = result;
     }
 };

+ 53 - 0
app/public/report/js/rpt_other_stage.js

@@ -0,0 +1,53 @@
+const rptOtherStage = (function (){
+    const info = {
+        advance: { title: '请选择预付款', colHeader: ['选择', '期', '审批状态'] },
+    };
+    const data = {};
+    let curType = '';
+    const initList = function () {
+        const header = info[curType].colHeader;
+        $('#sos-header').html(`<tr class="text-center"><th>${header[0]}</th><th>${header[1]}</th><th>${header[2]}</th></tr>`);
+        const html = [], arr = data[curType];
+        for (const a of arr) {
+            const checked = a.selected ? 'checked' : '';
+            html.push('<tr class="text-center">', `<td><input type="checkbox" name="sos-check" ${checked} value="${a.id}"></td>`, `<td>第${a.order}期</td>`, `<td>${a.statusStr}</td>`, '</tr>');
+        }
+        $('#sos-list').html(html.join(''));
+    };
+    const showOtherStage = async function (type) {
+        curType = type;
+        document.getElementById('sos-title').innerText = info[type].title;
+        if (!data[type]) {
+            const result = await postDataAsync(`/tender/${window.location.pathname.split('/')[2]}/load`, { filter: curType });
+            data[curType] = result[curType];
+        }
+        initList();
+        $('#select-other-stage').modal('show');
+        $('#sos-all').change(function () {
+            const check = this.checked;
+            $('[name=sos-check]').each((i, c) => { c.checked = check });
+        })
+    };
+    const updateOtherStage = async function () {
+        const updateData = {};
+        updateData[curType] = [];
+        $('[name=sos-check]').each((i, c) => {
+            const ci = data[curType].find(x => { return x.id == c.value });
+            const checked = c.checked ? 1 : 0;
+            if (ci && ci.selected !== checked) {
+                updateData[curType].push({id: c.value, selected: c.checked})
+            }
+        });
+        if (updateData[curType].length > 0) {
+            await postData(`/tender/${window.location.pathname.split('/')[2]}/saveRela`, updateData);
+            $('[name=sos-check]').each((i, c) => {
+                const ci = data[curType].find(x => {
+                    return x.id == c.value
+                });
+                if (ci) ci.selected = c.checked ? 1 : 0;
+            });
+        }
+        $('#select-other-stage').modal('hide');
+    };
+    return { showOtherStage, updateOtherStage }
+})();

+ 2 - 2
app/service/stage_audit.js

@@ -958,8 +958,8 @@ module.exports = app => {
                     order: audit.order + 1,
                     contract_tp: his.contract_tp,
                     qc_tp: his.qc_tp,
-                    yf_tp: his.tp,
-                    sf_tp: his.tp,
+                    yf_tp: his.yf_tp,
+                    sf_tp: his.sf_tp,
                 });
                 await transaction.update(this.ctx.service.stage.tableName, {
                     id: stageId,

+ 1 - 0
app/view/report/index.ejs

@@ -31,6 +31,7 @@
                     <div class="dropdown">
                         <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">报表数据预设</button>
                         <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+                            <a class="dropdown-item" href="javascript: void(0)" onclick="rptOtherStage.showOtherStage('advance');">预付款</a>
                             <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_project');">变更立项</a>
                             <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_apply');">变更申请</a>
                             <a class="dropdown-item" href="javascript: void(0)" onclick="rptChangeRela.showChangeRela('change_plan');">变更方案</a>

+ 27 - 0
app/view/report/rpt_all_popup.ejs

@@ -540,6 +540,33 @@
         </div>
     </div>
 </div>
+<div class="modal" id="select-other-stage" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title" id="sos-title">请选择变更令</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <table class="table table-bordered">
+                    <thead id="sos-header"><tr class="text-center"><th>选择</th><th>变更令号</th><th>工程名称</th></tr></thead>
+                    <tbody id="sos-list">
+                    </tbody>
+                </table>
+            </div>
+            <div class="modal-footer">
+                <div class="form-check form-check-inline mr-auto">
+                    <input class="form-check-input" type="checkbox" id="sos-all">
+                    <label class="form-check-label" for="sos-all">全选</label>
+                </div>
+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
+                <button class="btn btn-sm btn-primary" id="sos-ok" onclick="rptOtherStage.updateOtherStage();">确定</button>
+            </div>
+        </div>
+    </div>
+</div>
 <!--管理推荐报表-->
 <div class="modal fade" id="man-c" data-backdrop="static">
     <div class="modal-dialog" role="document">

+ 1 - 0
builder_report_index_define.js

@@ -46,6 +46,7 @@ const advance_pay = {
         { name: '备注', field: 'remark', type: dataType.str },
         { name: '结束时间', field: 'end_time', type: dataType.time },
         { name: '支付时间', field: 'pay_time', type: dataType.time },
+        { name: '报表用,是否选择', field: 'selected', type: dataType.int },
     ],
 };
 const ledger_cooperation = {

+ 1 - 0
config/web.js

@@ -768,6 +768,7 @@ const JsFiles = {
                     '/public/report/js/rpt_custom.js',
                     '/public/js/stage_audit.js',
                     '/public/report/js/rpt_change_rela.js',
+                    '/public/report/js/rpt_other_stage.js',
                 ],
                 mergeFile: 'report_main',
             },

+ 3 - 0
sql/update.sql

@@ -84,3 +84,6 @@ CREATE TABLE `zh_material_list_self`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '单独调差的清单表';
 
+ALTER TABLE `zh_advance_pay`
+ADD COLUMN `selected`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '报表用,是否选择' AFTER `id`;
+