Browse Source

工序报验、档案管理

MaiXinRong 4 years ago
parent
commit
dbcfbb28bc

+ 17 - 1
app/const/spread.js

@@ -13,6 +13,10 @@ const dgnCols = ['dgn_qty1', 'dgn_qty2', 'dgn_price'];
 const clCols = ['sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'quantity', 'total_price'];
 const stageDgnCols = ['deal_dgn_qty1', 'deal_dgn_qty2', 'c_dgn_qty1', 'c_dgn_qty2', 'final_dgn_price'];
 const realCompleteCols = ['real_qty', 'estimate_qty'];
+const thirdPartyCols = {
+    gxby: ['gxby'],
+    dagl: ['dagl']
+};
 
 const withCl = {
     ledger: {
@@ -193,6 +197,8 @@ const stageTz = {
             //{title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
             {title: '总额计量', colSpan: '1', rowSpan: '2', field: 'is_tp', hAlign: 1, width: 60, cellType: 'checkbox'},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -216,6 +222,8 @@ const stageTz = {
             {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 80, formatter: '@', cellType: 'autoTip'},
             {title: '图册号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 3,
         headRows: 2,
@@ -260,6 +268,8 @@ const stageCl = {
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
             {title: '总额计量', colSpan: '1', rowSpan: '2', field: 'is_tp', hAlign: 1, width: 60, cellType: 'checkbox'},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -287,6 +297,8 @@ const stageCl = {
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 80, formatter: '@', cellType: 'autoTip'},
             {title: '图册号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
             {title: '添加期数', colSpan: '1', rowSpan: '2', field: 'add_stage_order', hAlign:1, width: 80, readOnly: true},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 20,
         headRows: 2,
@@ -331,6 +343,8 @@ const stageNoCl = {
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
             {title: '总额计量', colSpan: '1', rowSpan: '2', field: 'is_tp', hAlign: 1, width: 60, cellType: 'checkbox'},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -355,6 +369,8 @@ const stageNoCl = {
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 80, formatter: '@', cellType: 'autoTip'},
             {title: '图册号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
             {title: '添加期数', colSpan: '1', rowSpan: '2', field: 'add_stage_order', hAlign:1, width: 80, readOnly: true},
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true},
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true},
         ],
         emptyRows: 20,
         headRows: 2,
@@ -540,7 +556,7 @@ module.exports = {
     stageNoCl,
     stageGather,
     stageCompare,
-    filterCols: { tzWithoutCols, dgnCols, clCols, stageDgnCols, realCompleteCols},
+    filterCols: { tzWithoutCols, dgnCols, clCols, stageDgnCols, realCompleteCols, thirdPartyCols},
     measure,
     blank,
 };

+ 26 - 0
app/const/third_party.js

@@ -0,0 +1,26 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+
+const gxby = [
+    {value: 0, name: '未开始'},
+    {value: 1, name: '进行中'},
+    {value: 2, name: '已完成'}
+];
+const dagl = [
+    {value: 0, name: '未完备'},
+    {value: 1, name: '第一阶段'},
+    {value: 2, name: '第二阶段'},
+    {value: 10, name: '完备'}
+];
+
+module.exports = {
+    gxby,
+    dagl
+};

+ 10 - 2
app/controller/stage_controller.js

@@ -23,6 +23,7 @@ const accountGroup = require('../const/account_group').group;
 const sendToWormhole = require('stream-wormhole');
 const billsPosConvert = require('../lib/bills_pos_convert');
 const fs = require('fs');
+const thirdParty = require('../const/third_party');
 
 module.exports = app => {
     class StageController extends app.BaseController {
@@ -54,6 +55,7 @@ module.exports = app => {
                 measureType,
                 preUrl: '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.params.order,
                 stage: ctx.stage,
+                thirdParty,
             };
             if ((ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === ctx.stage.user_id) {
                 data.accountGroup = accountGroup;
@@ -109,6 +111,14 @@ module.exports = app => {
             if (!tender.info.display.stage.realComplete) {
                 removeFieldCols(pos, spreadConst.filterCols.realCompleteCols);
             }
+            if (!this.ctx.session.sessionProject.gxby) {
+                removeFieldCols(ledger, spreadConst.filterCols.thirdPartyCols.gxby);
+                removeFieldCols(pos, spreadConst.filterCols.thirdPartyCols.gxby);
+            }
+            if (!this.ctx.session.sessionProject.dagl) {
+                removeFieldCols(ledger, spreadConst.filterCols.thirdPartyCols.dagl);
+                removeFieldCols(pos, spreadConst.filterCols.thirdPartyCols.dagl);
+            }
             if (this.ctx.stage.readOnly || this.ctx.stage.revising) {
                 ledger.readOnly = true;
                 pos.readOnly = true;
@@ -996,7 +1006,6 @@ module.exports = app => {
 
                 await ctx.service.stageAudit.start(ctx.stage.id, ctx.stage.times);
                 const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
-                console.log('stage-auditor:', auditor);
                 ctx.body = { err: 0, msg: '', data: [] };
             } catch (err) {
                 this.log(err);
@@ -1039,7 +1048,6 @@ module.exports = app => {
                     order: stageOrder,
                 });
                 const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
-                console.log('stage-auditor:', auditor, 'status:', stage.status);
                 ctx.body = { err: 0, msg: '', data: [] };
                 // ctx.redirect(ctx.request.header.referer);
             } catch (err) {

+ 3 - 2
app/lib/bills_pos_convert.js

@@ -69,7 +69,7 @@ class BillsPosConvert {
 
     _convertXmj(data) {
         const xmj = this.resultTree.addData(data, ['ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
-            'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'drawing_code', 'postil', 'memo']);
+            'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'drawing_code', 'postil', 'memo', 'gxby_status', 'dagl_status']);
         return xmj;
     }
     // v1
@@ -124,7 +124,8 @@ class BillsPosConvert {
         if (pos && pos.length > 0) {
             for (const p of pos) {
                 const posUnit = xmj.unitTree.addNode({pos_name: p.name,
-                    b_code: null, name: '', unit: null, unit_price: null});
+                    b_code: null, name: '', unit: null, unit_price: null,
+                    gxby_status: p.gxby_status, dagl_status: p.dagl_status});
                 if (p.drawing_code && posUnit.drawing_code.indexOf(p.drawing_code) < 0)
                     posUnit.drawing_code.push(p.drawing_code);
                 if (p.memo) posUnit.memo.push(p.memo);

+ 10 - 1
app/public/js/shares/sjs_setting.js

@@ -52,5 +52,14 @@ const sjsSettingObj = (function () {
             if (col) col.formatter = '#,##0.######';
         }
     };
-    return {setFxTreeStyle, FxTreeStyle, setGridSelectStyle, setTpThousandthFormat, setThousandthFormat};
+
+    const setPropValue = function (setting, fields, prop, value) {
+        for (const f of fields) {
+            const col = setting.cols.find(function (x) {
+                return x.field === f
+            });
+            if (col) col[prop] = value;
+        }
+    };
+    return {setFxTreeStyle, FxTreeStyle, setGridSelectStyle, setTpThousandthFormat, setThousandthFormat, setPropValue};
 })();

+ 17 - 0
app/public/js/stage.js

@@ -137,6 +137,19 @@ function getNodeList(node) {
     })
 }
 
+function getGxbyText(data) {
+    const def = thirdParty.gxby.find(function (x) {
+        return x.value === data.gxby_status;
+    });
+    return def ? def.name : '';
+}
+function getDaglText(data) {
+    const def = thirdParty.dagl.find(function (x) {
+        return x.value === data.dagl_status;
+    });
+    return def ? def.name : '';
+}
+
 $(document).ready(() => {
     let detail, searchLedger, checkedChanges;
     // 界面布局
@@ -508,6 +521,8 @@ $(document).ready(() => {
         }
     };
     sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
+    sjsSettingObj.setPropValue(ledgerSpreadSetting, ['gxby'], 'getValue', getGxbyText);
+    sjsSettingObj.setPropValue(ledgerSpreadSetting, ['dagl'], 'getValue', getDaglText);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
     SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
     slSpread.getActiveSheet().frozenColumnCount(5);
@@ -535,6 +550,8 @@ $(document).ready(() => {
     };
     sjsSettingObj.setGridSelectStyle(posSpreadSetting);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(posSpreadSetting);
+    sjsSettingObj.setPropValue(posSpreadSetting, ['gxby'], 'getValue', getGxbyText);
+    sjsSettingObj.setPropValue(posSpreadSetting, ['dagl'], 'getValue', getDaglText);
     SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting);
 
     const errorList = $.cs_errorList({

+ 6 - 0
app/service/project_account.js

@@ -225,6 +225,12 @@ module.exports = app => {
                         // permission,
                         // cooperation,
                     };
+
+                    const thirdParty = await this.db.get('zh_s2b_proj', { pid: projectInfo.id });
+                    if (thirdParty) {
+                        projectInfo.gxby = thirdParty.gxby;
+                        projectInfo.dagl = thirdParty.dagl;
+                    }
                     this.ctx.session.sessionProject = projectInfo;
                     this.ctx.session.sessionProjectList = projectList;
                 }

+ 26 - 1
app/view/stage/bwtz.ejs

@@ -80,6 +80,19 @@
     </div>
 </div>
 <script>
+    const thirdParty = JSON.parse('<%- JSON.stringify(thirdParty) %>');
+    function getGxbyText(data) {
+        const def = thirdParty.gxby.find(function (x) {
+            return x.value === data.gxby_status;
+        });
+        return def ? def.name : '';
+    }
+    function getDaglText(data) {
+        const def = thirdParty.dagl.find(function (x) {
+            return x.value === data.dagl_status;
+        });
+        return def ? def.name : '';
+    }
     const xmjSpreadSetting = {
         cols: [
             {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
@@ -100,7 +113,13 @@
             {title: '|完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 70, type: 'Number'},
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
-            {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'}
+            {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
+            <% if (ctx.session.sessionProject.gxby) { %>
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true, getValue: getGxbyText},
+            <% } %>
+            <% if (ctx.session.sessionProject.dagl) { %>
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true, getValue: getDaglText},
+            <% } %>
         ],
         emptyRows: 0,
         headRows: 2,
@@ -151,6 +170,12 @@
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code_merge', hAlign: 0, width: 80, formatter: '@'},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil_merge', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo_merge', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
+            <% if (ctx.session.sessionProject.gxby) { %>
+            {title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true, getValue: getGxbyText},
+            <% } %>
+            <% if (ctx.session.sessionProject.dagl) { %>
+            {title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true, getValue: getDaglText},
+            <% } %>
         ],
         emptyRows: 0,
         headRows: 2,

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

@@ -591,6 +591,7 @@
     const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
     const cur_uid = '<%- ctx.session.sessionUser.accountId %>';
     const curAuditor = JSON.parse('<%- JSON.stringify(curAuditor) %>');
+    const thirdParty = JSON.parse('<%- JSON.stringify(thirdParty) %>');
 </script>
 <% if (ctx.stage.status === auditConst.status.uncheck && ctx.session.sessionUser.accountId === ctx.stage.user_id) {%>
 <script>