Browse Source

计量台账,质检资料显示相关

MaiXinRong 2 ngày trước cách đây
mục cha
commit
f5d7b8cf4d

+ 12 - 0
app/const/spread.js

@@ -166,6 +166,7 @@ const BaseSetCol = {
         { key: 'is_tp', name: '总额计量', fixed: [], bills: 1, pos: 0 },
         { key: 'gxby', name: '工序报验', fixed: ['valid', 'alias'], bills: 1, pos: 1, },
         { key: 'dagl', name: '档案管理', fixed: ['valid', 'alias'], bills: 1, pos: 1, },
+        { key: 'wbs_url', name: '3方链接', fixed: ['valid', 'alias'], bills: 1, pos: 1, init: 1 },
         { key: 'ex_calc1', name: '计算1', fixed: [], bills: 1, pos: 1, },
         { key: 'cur_ex_calc1', name: '本期计算1', fixed: [], bills: 1, pos: 1, },
         { key: 'end_ex_calc1', name: '截止本期计算1', fixed: [], bills: 1, pos: 1, },
@@ -218,6 +219,7 @@ const BaseSetCol = {
         { key: 'is_tp', name: '总额计量', fixed: [], bills: 1, pos: 0 },
         { key: 'gxby', name: '工序报验', fixed: ['valid', 'alias'], bills: 1, pos: 1, },
         { key: 'dagl', name: '档案管理', fixed: ['valid', 'alias'], bills: 1, pos: 1, },
+        { key: 'wbs_url', name: '3方链接', fixed: ['valid', 'alias'], bills: 1, pos: 1, init: 1 },
         { key: 'ex_calc1', name: '计算1', fixed: [], bills: 1, pos: 1, },
         { key: 'cur_ex_calc1', name: '本期计算1', fixed: [], bills: 1, pos: 1, },
         { key: 'end_ex_calc1', name: '截止本期计算1', fixed: [], bills: 1, pos: 1, },
@@ -272,6 +274,7 @@ const glSpreadTemplate = {
         { key: 'is_tp', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -324,6 +327,7 @@ const glSpreadTemplate = {
         { key: 'add_stage_order', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -377,6 +381,7 @@ const szSpreadTemplate = {
         { key: 'is_tp', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -429,6 +434,7 @@ const szSpreadTemplate = {
         { key: 'add_stage_order', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -482,6 +488,7 @@ const fjSpreadTemplate = {
         { key: 'is_tp', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -534,6 +541,7 @@ const fjSpreadTemplate = {
         { key: 'add_stage_order', valid: 1},
         { key: 'gxby', valid: 1},
         { key: 'dagl', valid: 1},
+        { key: 'wbs_url', valid: 1 },
         { key: 'ex_calc1', valid: 0 },
         { key: 'cur_ex_calc1', valid: 0 },
         { key: 'end_ex_calc1', valid: 0 },
@@ -656,6 +664,7 @@ const BaseSpreadColSetting = {
             is_tp: [{title: '总额计量', colSpan: '1', rowSpan: '2', field: 'is_tp', hAlign: 1, width: 60, cellType: 'checkbox'}],
             gxby: [{title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 1, width: 80, formatter: '@', readOnly: true}],
             dagl: [{title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 1, width: 80, formatter: '@', readOnly: true}],
+            wbs_url: [{ title: '3方链接', colSpan: '1', rowSpan: '2', field: 'wbs_url', hAlign: 0, width: 60, formatter: '@', readOnly: true }],
             drawing_code: [{title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', textIndent: 1}],
             node_type: [{title: '费用类别', colSpan: '1', rowSpan: '2', field: 'node_type', hAlign: 0, width: 100, cellType: 'customizeCombo'}],
             memo: [{title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'}],
@@ -705,6 +714,7 @@ const BaseSpreadColSetting = {
             add_stage_order: [{title: '添加期数', colSpan: '1', rowSpan: '2', field: 'add_stage_order', hAlign:1, width: 80, readOnly: true}],
             gxby: [{title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
             dagl: [{title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
+            wbs_url: [{ title: '3方链接', colSpan: '1', rowSpan: '2', field: 'wbs_url', hAlign: 0, width: 60, formatter: '@', readOnly: true }],
             ex_calc1: [{title: '计算1数量', colSpan: '1', rowSpan: '2', field: 'ex_qty1', hAlign: 2, width: 100, type: 'Number', readOnly: true, aliasFormat: '{%s}数量'}],
             cur_ex_calc1: [{title: '本期计量1数量', colSpan: '1', rowSpan: '2', field: 'ex_stage_qty1', hAlign: 2, width: 100, type: 'Number', aliasFormat: '{%s}数量'}],
             end_ex_calc1: [{title: '截止本期计量1数量', colSpan: '1', rowSpan: '2', field: 'end_ex_stage_qty1', hAlign: 2, width: 100, type: 'Number', readOnly: true, aliasFormat: '{%s}数量'}],
@@ -820,6 +830,7 @@ const BaseSpreadColSetting = {
             is_tp: [{title: '总额计量', colSpan: '1', rowSpan: '2', field: 'is_tp', hAlign: 1, width: 60, cellType: 'checkbox'}],
             gxby: [{title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
             dagl: [{title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
+            wbs_url: [{ title: '3方链接', colSpan: '1', rowSpan: '2', field: 'wbs_url', hAlign: 0, width: 60, formatter: '@', readOnly: true }],
             drawing_code: [{title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', textIndent: 1}],
             memo: [{title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'}],
             node_type: [{title: '费用类别', colSpan: '1', rowSpan: '2', field: 'node_type', hAlign: 0, width: 100, cellType: 'customizeCombo'}],
@@ -869,6 +880,7 @@ const BaseSpreadColSetting = {
             add_stage_order: [{title: '添加期数', colSpan: '1', rowSpan: '2', field: 'add_stage_order', hAlign:1, width: 80, readOnly: true}],
             gxby: [{title: '工序报验', colSpan: '1', rowSpan: '2', field: 'gxby', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
             dagl: [{title: '档案管理', colSpan: '1', rowSpan: '2', field: 'dagl', hAlign: 0, width: 80, formatter: '@', readOnly: true}],
+            wbs_url: [{ title: '3方链接', colSpan: '1', rowSpan: '2', field: 'wbs_url', hAlign: 0, width: 60, formatter: '@', readOnly: true }],
             ex_calc1: [{title: '计算1数量', colSpan: '1', rowSpan: '2', field: 'ex_qty1', hAlign: 2, width: 100, type: 'Number', aliasFormat: '{%s}数量'}],
             cur_ex_calc1: [{title: '本期计量1数量', colSpan: '1', rowSpan: '2', field: 'ex_stage_qty1', hAlign: 2, width: 100, type: 'Number', aliasFormat: '{%s}数量'}],
             end_ex_calc1: [{title: '截止本期计量1数量', colSpan: '1', rowSpan: '2', field: 'end_ex_stage_qty1', hAlign: 2, width: 100, type: 'Number', readOnly: true, aliasFormat: '{%s}数量'}],

+ 7 - 3
app/controller/stage_controller.js

@@ -160,8 +160,9 @@ module.exports = app => {
                 const renderData = await this._getDefaultRenderData(ctx);
                 const projectFunInfo = this.ctx.subProject.fun_rela;
                 renderData.minusNoValue = projectFunInfo.minusNoValue && ctx.tender.info.fun_rela.stage_change.minusNoValue;
+                renderData.load3fRelaFile = await this.ctx.service.specPull.loadWbsFile(this.ctx.session.sessionProject.id);
                 [renderData.ledgerSpread, renderData.posSpread] = await spreadSetting.getStageSpreadSetting(ctx, ctx.tender.id,
-                    this.ctx.stage.readOnly || this.ctx.stage.revising, {minusNoValue: renderData.minusNoValue});
+                    this.ctx.stage.readOnly || this.ctx.stage.revising, renderData);
                 renderData.changeConst = changeConst;
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.index);
                 renderData.whiteList = ctx.app.config.multipart.whitelist;
@@ -213,7 +214,7 @@ module.exports = app => {
             return surplus;
         }
 
-        async _getLedgerColumn() {
+        async _getLedgerColumn(load3fRelaFile) {
             const tender = this.ctx.tender;
             this.ledgerColumn = [
                 'id', 'tender_id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf',
@@ -223,6 +224,7 @@ module.exports = app => {
             if (tender.info.display.ledger.dgnQty) this.ledgerColumn.push('dgn_qty1', 'dgn_qty2');
 
             this.ledgerExtraColumn = ['is_tp'];
+            if (load3fRelaFile) this.ledgerExtraColumn.push('wbs_url');
             if (this.ctx.session.sessionProject.gxby) this.ledgerExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             if (this.ctx.session.sessionProject.dagl) this.ledgerExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
             // if (tender.data.s2b_multi_check) this.ledgerExtraColumn.push('multi_limit', 'gxby_date');
@@ -233,6 +235,7 @@ module.exports = app => {
             if (tender.info.display.stage.realComplete) this.posColumn.push('real_qty');
 
             this.posExtraColumn = [];
+            if (load3fRelaFile) this.posExtraColumn.push('wbs_url');
             if (this.ctx.session.sessionProject.gxby) this.posExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             if (this.ctx.session.sessionProject.dagl) this.posExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
             // if (tender.data.s2b_multi_check) this.posExtraColumn.push('gxby_date');
@@ -414,8 +417,9 @@ module.exports = app => {
                 const data = JSON.parse(ctx.request.body.data);
                 const filter = data.filter.split(';');
                 const responseData = { err: 0, msg: '', data: {}, hpack: [] };
+                const load3fRelaFile = await this.ctx.service.specPull.loadWbsFile(this.ctx.session.sessionProject.id);
                 const hpack = true;
-                await this._getLedgerColumn();
+                await this._getLedgerColumn(load3fRelaFile);
                 for (const f of filter) {
                     switch (f) {
                         case 'ledger':

+ 9 - 0
app/lib/spread_setting.js

@@ -126,6 +126,15 @@ const getStageSpreadSetting = async function (ctx, tid, readOnly, funInfo) {
         removeFieldCols(ledger, spreadConst.filterCols.thirdPartyCols.dagl);
         removeFieldCols(pos, spreadConst.filterCols.thirdPartyCols.dagl);
     }
+    if (!funInfo.load3fRelaFile) {
+        removeFieldCols(ledger, spreadConst.filterCols.thirdPartyCols.wbs_url);
+        removeFieldCols(pos, spreadConst.filterCols.thirdPartyCols.wbs_url);
+    } else if(funInfo.load3fRelaFile.extra_option.wbs_url) {
+        const ledgerCol = ledger.cols.find(x => { return x.field === 'wbs_url'; });
+        if (ledgerCol) ledgerCol.title = funInfo.load3fRelaFile.extra_option.wbs_url;
+        const posCol = pos.cols.find(x => { return x.field === 'wbs_url'; });
+        if (posCol) posCol.title = funInfo.load3fRelaFile.extra_option.wbs_url;
+    }
     if (!funInfo.minusNoValue || !tender.info.fun_rela.stage_change.minusNoValue) {
         hiddenFieldCols(ledger, spreadConst.filterCols.minusNoValueCols);
         hiddenFieldCols(pos, spreadConst.filterCols.minusNoValueCols);

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

@@ -50,7 +50,12 @@ $(document).ready(() => {
         });
         BaseSetCol.forEach(x => {
             const col = colSet.find(c => { return c.key === x.key });
-            if (!col) data.push({ ...x, valid: 0});
+            if (!col) {
+                const colData = { ...x, valid: x.init || 0 };
+                if (colData.bills && colData.bills_valid === undefined) colData.bills_valid = colData.valid;
+                if (colData.pos && colData.pos_valid === undefined) colData.pos_valid = colData.valid;
+                data.push(colData);
+            }
         });
         SpreadJsObj.loadSheetData(colSheet, SpreadJsObj.DataType.Data, data);
     };

+ 2 - 2
app/public/js/shares/sjs_setting.js

@@ -127,9 +127,9 @@ const sjsSettingObj = (function () {
     const set3FCols = function (cols, rela) {
         setRelaCols(cols, rela, function(col, r) {
             col.getValue = r.getValue;
-            col.cellType = 'imageBtn';
+            col.cellType = r.cellType || 'imageBtn';
             col.normalImg = '#rela-file-icon';
-            col.indent = 12;
+            col.indent = r.indent || 12;
             col.imgAlign = 2;
             col.showImage = function (data) { return data && data[r.url_field]; }
         });

+ 11 - 6
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -2027,7 +2027,7 @@ const SpreadJsObj = {
                             canvas.fillRect((x + x + w - indent - img.width) / 2, y, (indent + img.width + img.width) / 2, h);
                             canvas.restore();
                         }
-                        canvas.drawImage(img, (x + 10 + x + w - indent - img.width) / 2, y + (h - img.height) / 2);
+                        canvas.drawImage(img, (x + x + w - indent - img.width) / 2, y + (h - img.height) / 2);
                         w = w - indent - img.width;
                     }
                     // Drawing Text
@@ -2037,10 +2037,10 @@ const SpreadJsObj = {
                         if (style.backColor) {
                             canvas.save();
                             canvas.fillStyle = style.backColor;
-                            canvas.fillRect(x, y, indent + img.width, h);
+                            canvas.fillRect(x + indent, y, indent + img.width, h);
                             canvas.restore();
                         }
-                        canvas.drawImage(img, x + 10, y + (h - img.height) / 2);
+                        canvas.drawImage(img, x + indent, y + (h - img.height) / 2);
                         if (style.hAlign !== spreadNS.HorizontalAlign.left) {
                             style.hAlign = spreadNS.HorizontalAlign.left;
                         }
@@ -2122,9 +2122,14 @@ const SpreadJsObj = {
                 const img = this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col);
                 const halfX = img.width / 2, halfY = img.height / 2;
                 const indent = col.indent ? col.indent : 10;
-                const centerX = hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.right
-                    ? hitinfo.cellRect.x + hitinfo.cellRect.width - indent -halfX
-                    : hitinfo.cellRect.x + indent + halfX;
+                let centerX;
+                if (hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.right) {
+                    centerX = hitinfo.cellRect.x + hitinfo.cellRect.width - indent - halfX;
+                } else if (hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.center) {
+                    centerX = hitinfo.cellRect.x + (hitinfo.cellRect.width - indent) / 2 + halfX;
+                } else {
+                    centerX = hitinfo.cellRect.x + indent + halfX
+                }
                 const centerY = hitinfo.cellRect.y + hitinfo.cellRect.height / 2;
 
                 if (Math.abs(hitinfo.x - centerX) < halfX && Math.abs(hitinfo.y - centerY) < halfY) {

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

@@ -179,6 +179,9 @@ function getDaglText(data) {
     });
     return def ? def.name : '';
 }
+function getWbsText(data) {
+    return '';
+}
 
 function getHintMsg () {
     return {
@@ -772,6 +775,7 @@ $(document).ready(() => {
         switch (col.field) {
             case 'dagl': data.dagl_url && window.open(data.dagl_url); break;
             case 'gxby': data.gxby_url && window.open(data.gxby_url); break;
+            case 'wbs_url': data.wbs_url && window.open(data.wbs_url, '_target'); break;
             case 'qc_qty':
             case 'qc_minus_qty':
                 if (data.children && data.children.length > 0 || data.lock || data.is_import || data.settle_status === settleStatus.finish) return;
@@ -812,6 +816,7 @@ $(document).ready(() => {
     sjsSettingObj.set3FCols(ledgerSpreadSetting.cols, [
         {field: 'gxby', getValue: getGxbyText, url_field: 'gxby_url'},
         {field: 'dagl', getValue: getDaglText, url_field: 'dagl_url'},
+        {field: 'wbs_url', getValue: getWbsText, url_field: 'wbs_url', cellType: 'imageBtn', indent: 20},
     ]);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
     ledgerSpreadSetting.headColWidth = [50];
@@ -869,6 +874,7 @@ $(document).ready(() => {
         switch (col.field) {
             case 'gxby': data.gxby_url && window.open(data.gxby_url); break;
             case 'dagl': data.dagl_url && window.open(data.dagl_url); break;
+            case 'wbs_url': data.wbs_url && window.open(data.wbs_url, '_blank'); break;
             case 'qc_qty':
             case 'qc_minus_qty':
                 const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
@@ -903,6 +909,7 @@ $(document).ready(() => {
     sjsSettingObj.set3FCols(posSpreadSetting.cols, [
         {field: 'gxby', getValue: getGxbyText, url_field: 'gxby_url'},
         {field: 'dagl', getValue: getDaglText, url_field: 'dagl_url'},
+        {field: 'wbs_url', getValue: getWbsText, url_field: 'wbs_url', cellType: 'imageBtn', indent: 20},
     ]);
     SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting);
 

+ 14 - 0
app/service/spec_pull.js

@@ -25,6 +25,20 @@ module.exports = app => {
             const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'sync-ledger' });
             return pull;
         }
+
+        async syncRevise(pid) {
+            const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'sync-revise' });
+            return pull;
+        }
+
+        async loadWbsFile(pid) {
+            const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'load-wbs-info' });
+            if (pull) {
+                pull.extra_option = pull.extra_option ? JSON.parse(pull.extra_option) : {};
+                delete pull.info;
+            }
+            return pull;
+        }
     }
 
     return SpecPull;

+ 4 - 0
sql/update.sql

@@ -58,6 +58,10 @@ CREATE TABLE `zh_quality_inspection_attachment`  (
   INDEX `idx_cid`(`qiid`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '质量巡检附件表' ROW_FORMAT = Dynamic;
 
+ALTER TABLE `zh_s2b_spec_pull`
+ADD COLUMN `extra_option` varchar(1000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '{}' COMMENT '额外配置' AFTER `pull_class`,
+ADD COLUMN `check_api` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'api验证方法' AFTER `extra_option`;
+
 ------------------------------------
 -- 表数据
 ------------------------------------