浏览代码

1. 清单精度,去掉总额
2. 单位,动态下拉选择
3. 标段列表,筛选参与标段

MaiXinRong 6 年之前
父节点
当前提交
8fe5ed388c

+ 6 - 6
app/const/spread.js

@@ -17,7 +17,7 @@ const ledgerSpread = {
         {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
         {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
         {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-        {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
+        {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
         {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.unit_price'},
         {title: '设计数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.dgnQty'},
         {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.dgnQty'},
@@ -53,7 +53,7 @@ const stage = {
             {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', readOnly: true, cellType: 'tree'},
             {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
-            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true, cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '设计数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -112,7 +112,7 @@ const stageGather = {
         cols: [
             {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
             {title: '签约|数量', colSpan: '2|1', rowSpan: '1|1', field: 'deal_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'deal_tp', hAlign: 2, width: 60, type: 'Number'},
@@ -176,7 +176,7 @@ const stageCompare = {
             {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
             {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
         ],
         extraCols: [
@@ -214,7 +214,7 @@ measure.gather.billsSpread = {
     cols: [
         {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'b_code', hAlign: 0, width: 120, formatter: '@'},
         {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-        {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 0, width: 60, formatter: '@'},
+        {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 0, width: 60, formatter: '@', cellType: 'unit'},
         {title: '单价', colSpan: '1', rowSpan: '1', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
     ],
     emptyRows: 0,
@@ -227,7 +227,7 @@ measure.compare.ledger = {
         {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
         {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
         {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-        {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
+        {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
         {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
     ],
     emptyRows: 3,

+ 0 - 1
app/const/tender_info.js

@@ -75,7 +75,6 @@ const defaultInfo = {
         tao: { unit: '套', value: 0 },
         ke: { unit: '棵', value: 0 },
         zu: { unit: '组', value: 0 },
-        zonge: { unit: '总额', value: 0 },
         xitong: { unit: '系统', value: 0 },
         other: { value: 3 },
     },

+ 53 - 0
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -355,6 +355,12 @@ const SpreadJsObj = {
             }
             sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.checkbox);
         }
+        if (colSetting.cellType === 'unit') {
+            if (!sheet.extendCellType.unit) {
+                sheet.extendCellType.unit = this.CellType.getUnitCellType();
+            }
+            sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.unit);
+        }
         if (colSetting.formatter) {
             sheet.getRange(-1, col, -1, 1).formatter(colSetting.formatter);
         }
@@ -1320,5 +1326,52 @@ const SpreadJsObj = {
             };
             return new EllipsisTextCellType();
         },
+        /**
+         * 获取 动态显示ComboBox的cellType
+         * @returns {ActiveComboCellType}
+         */
+        getActiveComboCellType: function () {
+            const ActiveComboCellType = function () { };
+            ActiveComboCellType.prototype = new spreadNS.CellTypes.ComboBox();
+            const proto = ActiveComboCellType.prototype;
+            proto.paintValue = function (ctx, value, x, y, w, h, style, options) {
+                const sheet = options.sheet;
+                if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()
+                    && !sheet.getCell(options.row, options.col).locked()) {
+                    spreadNS.CellTypes.ComboBox.prototype.paintValue.apply(this, arguments);
+                } else {
+                    spreadNS.CellTypes.Base.prototype.paintValue.apply(this, arguments);
+                }
+            };
+            proto.getHitInfo = function (x, y, cellStyle, cellRect, options) {
+                const sheet = options.sheet;
+                if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()
+                    && !sheet.getCell(options.row, options.col).locked()) {
+                    return spreadNS.CellTypes.ComboBox.prototype.getHitInfo.apply(this, [x, y, cellStyle, cellRect, options]);
+                } else {
+                    return  {
+                        x: x,
+                        y: y,
+                        row: options.row,
+                        col: options.col,
+                        cellStyle: cellStyle,
+                        cellRect: cellRect,
+                        sheetArea: options.sheetArea
+                    };
+                }
+            };
+            return new ActiveComboCellType();
+        },
+        /**
+         * 获取 单位的CellType
+         * @returns {GC.Spread.Sheets.CellTypes.ComboBox}
+         */
+        getUnitCellType: function () {
+            let combo = this.getActiveComboCellType();
+            combo.itemHeight(10).items(['m', 'km', 'm2', 'm3', 'kg', 't', 'à·km', '总额', '月', '项', '处', '个', '根',
+                '棵', '块', '每一试桩', '桥长米', '公路公里', '株', '组', '座', '元', '工日', '套', '台班', '艘班', 'm/处',
+                'm/道', 'm/座', 'm2/m', 'm3/m', 'm3/处', '根/米', '亩', 'm3/m2', 'dm3']);
+            return combo;
+        }
     }
 };

+ 0 - 2
app/public/js/tender.js

@@ -81,7 +81,6 @@ function loadPrecisionProperty () {
     $('#unit-tao').val(property.precision.tao.value);
     $('#unit-ke').val(property.precision.ke.value);
     $('#unit-zu').val(property.precision.zu.value);
-    $('#unit-zonge').val(property.precision.zonge.value);
     $('#unit-xitong').val(property.precision.xitong.value);
     $('#unit-other').val(property.precision.other.value);
 }
@@ -288,7 +287,6 @@ $(document).ready(function() {
         prop.precision.tao.value = _.toNumber($('#unit-tao').val());
         prop.precision.ke.value = _.toNumber($('#unit-ke').val());
         prop.precision.zu.value = _.toNumber($('#unit-zu').val());
-        prop.precision.zonge.value = _.toNumber($('#unit-zonge').val());
         prop.precision.xitong.value = _.toNumber($('#unit-xitong').val());
         prop.precision.other.value = _.toNumber($('#unit-other').val());
         const tenderId = window.location.pathname.split('/')[2];

+ 22 - 9
app/service/tender.js

@@ -9,6 +9,7 @@
  */
 
 const tenderConst = require('../const/tender');
+const auditConst = require('../const/audit');
 const commonQueryColumns = ['id', 'project_id', 'name', 'status', 'category', 'ledger_times', 'ledger_status', 'measure_type', 'user_id'];
 
 module.exports = app => {
@@ -70,20 +71,32 @@ module.exports = app => {
         }
 
         /**
-         * 获取标段列表
+         * 获取你所参与的标段列表
          *
          * @return {Array} - 返回标段数据
          */
         async getList() {
             // 获取当前项目信息
-            const sessionProject = this.ctx.session.sessionProject;
-            this.initSqlBuilder();
-            this.sqlBuilder.setAndWhere('project_id', {
-                value: sessionProject.id,
-                operate: '=',
-            });
-            this.sqlBuilder.columns = commonQueryColumns;
-            const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
+            const session = this.ctx.session;
+            const sql = 'SELECT t.`id`, t.`project_id`, t.`name`, t.`status`, t.`category`, t.`ledger_times`, t.`ledger_status`, t.`measure_type`, t.`user_id` '+
+                        'FROM ?? As t WHERE t.`project_id` = ? AND (' +
+                        // 创建的标段
+                        '  t.`user_id` = ?' +
+                        // 参与审批 台账 的标段
+                        '  OR (t.`ledger_status` != ' + auditConst.ledger.status.uncheck + ' AND ' +
+                        '      t.id IN ( SELECT la.`tender_id` FROM ?? As la WHERE la.`audit_id` = ? GROUP BY la.`tender_id`))' +
+                        // 参与审批 计量期 的标段
+                        '  OR (t.`ledger_status` = ' + auditConst.ledger.status.checked + ' AND ' +
+                        '      t.id IN ( SELECT sa.`tid` FROM ?? As sa WHERE sa.`aid` = ? GROUP BY sa.`tid`))' +
+                        // 参与审批 变更令 的标段
+                        '  OR (t.`ledger_status` = ' + auditConst.ledger.status.checked + ' AND ' +
+                        '      t.id IN ( SELECT ca.`tid` FROM ?? AS ca WHERE ca.`uid` = ? GROUP BY ca.`tid`))' +
+                        // 未参与,但可见的标段
+                        ')';
+            const sqlParam = [this.tableName, session.sessionProject.id, session.sessionUser.accountId,
+            this.ctx.service.ledgerAudit.tableName, session.sessionUser.accountId,
+            this.ctx.service.stageAudit.tableName, session.sessionUser.accountId,
+            this.ctx.service.changeAudit.tableName, session.sessionUser.accountId];
 
             const list = await this.db.query(sql, sqlParam);
             for (const l of list) {

+ 0 - 8
app/view/tender/detail.ejs

@@ -533,14 +533,6 @@
                                         <div class="col-2 mb-3">
                                             <div class="input-group input-group-sm">
                                                 <div class="input-group-prepend">
-                                                    <span class="input-group-text">总额</span>
-                                                </div>
-                                                <input class="form-control" type="number" min="0" max="6" value="3" id="unit-zonge">
-                                            </div>
-                                        </div>
-                                        <div class="col-2 mb-3">
-                                            <div class="input-group input-group-sm">
-                                                <div class="input-group-prepend">
                                                     <span class="input-group-text">系统</span>
                                                 </div>
                                                 <input class="form-control" type="number" min="0" max="6" value="3" id="unit-xitong">