Ver código fonte

1. 待办事项,提示待审批变更令
2. 期计量,部位明细不可计量问题
3. 新增期,日期选择相关控制
4. 期计量,数量变更计量--数量列,...按钮,点击弹出调用变更令窗口

MaiXinRong 6 anos atrás
pai
commit
4da1c64fc3

+ 1 - 1
app/const/spread.js

@@ -64,7 +64,7 @@ const stage = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number',},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'qc_tp_bgl', hAlign: 2, width: 60, readOnly: true, formatter: '@'},
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},

+ 3 - 0
app/controller/dashboard_controller.js

@@ -23,11 +23,14 @@ module.exports = app => {
         async index(ctx) {
             const auditTenders = await ctx.service.ledgerAudit.getAuditTender(ctx.session.sessionUser.accountId);
             const auditStages = await ctx.service.stageAudit.getAuditStage(ctx.session.sessionUser.accountId);
+            const auditChanges = await ctx.service.changeAudit.getAuditChange(ctx.session.sessionUser.accountId);
             const renderData = {
                 auditTenders,
                 auditStages,
+                auditChanges,
                 acLedger: auditConst.ledger,
                 acStage: auditConst.stage,
+                acChange: auditConst.flow,
             };
             await this.layout('dashboard/index.ejs', renderData);
         }

+ 9 - 0
app/controller/stage_controller.js

@@ -567,6 +567,15 @@ module.exports = app => {
             }
         }
 
+        /**
+         * 查询可用变更令
+         * @param ctx
+         * @returns {Promise<void>}
+         */
+        async searchValidChange(ctx) {
+
+        }
+
         // 审批相关
         /**
          * 添加审批人

BIN
app/public/images/ellipsis_horizontal.png


+ 5 - 2
app/public/js/datepicker/datepicker.zh.js

@@ -1,4 +1,5 @@
-;(function (jQuery) { jQuery.fn.datepicker.language['zh'] = {
+;(function (jQuery) {
+    jQuery.fn.datepicker.language['zh'] = {
     days: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
     daysShort: ['日', '一', '二', '三', '四', '五', '六'],
     daysMin: ['日', '一', '二', '三', '四', '五', '六'],
@@ -9,4 +10,6 @@
     dateFormat: 'yyyy-mm-dd',
     timeFormat: 'hh:ii',
     firstDay: 0
-}; })(jQuery);
+    };
+    jQuery.fn.datepicker.autoClose = true;
+})(jQuery);

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

@@ -556,7 +556,7 @@ $(document).ready(function() {
                     }
                 },
                 'batchInsertBillsPos': {
-                    name: '批量插入清单部位',
+                    name: '批量插入清单-部位',
                     icon: 'fa-sign-in',
                     disabled: function (key, opt) {
                         const sheet = ledgerSpread.getActiveSheet();

+ 31 - 14
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -1067,7 +1067,6 @@ const SpreadJsObj = {
          */
         getImageButtonCellType: function () {
             let hover = 1, active = 2;
-            const indent = 10;
             const ImageCellType = function (){};
             ImageCellType.prototype = new spreadNS.CellTypes.Text();
             const proto = ImageCellType.prototype;
@@ -1091,22 +1090,40 @@ const SpreadJsObj = {
             };
             proto.paint = function (canvas, value, x, y, w, h, style, options) {
                 const img = this.getImage(options.sheet, options.row, options.col);
-                if (img) {
-                    if (style.backColor) {
-                        canvas.save();
-                        canvas.fillStyle = style.backColor;
-                        canvas.fillRect(x, y, indent + img.width, h);
-                        canvas.restore();
+                const col = options.sheet.zh_setting.cols[options.col];
+                const indent = col.indent ? col.indent : 10;
+                if (style.hAlign === spreadNS.HorizontalAlign.right) {
+                    if (img) {
+                        if (style.backColor) {
+                            canvas.save();
+                            canvas.fillStyle = style.backColor;
+                            canvas.fillRect(x + w - indent - img.width, y, img.width, h);
+                            canvas.restore();
+                        }
+                        canvas.drawImage(img, x + w - indent - img.width, y + (h - img.height) / 2);
+                        w = w - indent - img.width;
                     }
-                    canvas.drawImage(img, x + 10, y + (h - img.height) / 2);
-                    if (style.hAlign !== spreadNS.HorizontalAlign.left) {
-                        style.hAlign = spreadNS.HorizontalAlign.left;
+                    // Drawing Text
+                    spreadNS.CellTypes.Text.prototype.paint.apply(this, [canvas, value, x, y, w, h, style, options]);
+                } else {
+                    if (img) {
+                        if (style.backColor) {
+                            canvas.save();
+                            canvas.fillStyle = style.backColor;
+                            canvas.fillRect(x, y, indent + img.width, h);
+                            canvas.restore();
+                        }
+                        canvas.drawImage(img, x + 10, y + (h - img.height) / 2);
+                        if (style.hAlign !== spreadNS.HorizontalAlign.left) {
+                            style.hAlign = spreadNS.HorizontalAlign.left;
+                        }
+                        x = x + indent + img.width;
+                        w = w - indent - img.width;
                     }
-                    x = x + indent + img.width;
-                    w = w - indent - img.width;
+                    // Drawing Text
+                    spreadNS.CellTypes.Text.prototype.paint.apply(this, [canvas, value, x, y, w, h, style, options]);
                 }
-                // Drawing Text
-                spreadNS.CellTypes.Text.prototype.paint.apply(this, [canvas, value, x, y, w, h, style, options]);
+
             };
             /**
              * 获取点击信息

+ 16 - 4
app/public/js/stage.js

@@ -53,6 +53,18 @@ $(document).ready(() => {
     // 初始化 台账 spread
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
+    // 数量变更列,添加按钮
+    const col = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'});
+    col.readOnly = true;
+    col.cellType = 'imageBtn';
+    col.hoverImg = '#ellipsis-icon';
+    col.indent = 5;
+    ledgerSpreadSetting.imageClick = function (data) {
+        postData(window.location.pathname + 'valid-change', data, function (result) {
+            $('#use-bg').modal('show');
+        });
+    };
+    //
     SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
     const stageTreeSetting = {
         id: 'ledger_id',
@@ -258,7 +270,7 @@ $(document).ready(() => {
                 SpreadJsObj.loadSheetData(spSpread.getActiveSheet(), 'data', []);
             }
         },
-        editEdited: function (e, info) {
+        editEnded: function (e, info) {
             if (info.sheet.zh_setting) {
                 // 未改变过,则直接跳过
                 const posData = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
@@ -304,13 +316,13 @@ $(document).ready(() => {
                         }
                     } else {
                         data.updateType = 'update';
-                        data.updateData = {id: pos.id, name: info.editingText};
+                        data.updateData = {id: posData.id, name: info.editingText};
                     }
-                } else if (!pos) {
+                } else if (!posData) {
                     toast('新增部位请先输入名称', 'warning');
                 } else {
                     data.updateType = 'update';
-                    data.updateData = {pid: pos.id, lid: pos.lid};
+                    data.updateData = {pid: posData.id, lid: posData.lid};
                     data.updateData[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
                 }
                 // 提交数据到服务器

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

@@ -212,7 +212,6 @@ $(document).ready(function() {
             }
         };
         const tenderId = window.location.pathname.split('/')[2];
-        console.log(prop);
         postData('/tender/' + tenderId + '/save', prop, function (data) {
             setReadOnly('#v-pills-1', true);
             property.deal_info = data.deal_info;

+ 1 - 0
app/router.js

@@ -125,6 +125,7 @@ module.exports = app => {
     app.get('/tender/:id/measure/stage/:order', sessionAuth, tenderCheck, 'stageController.index');
     app.post('/tender/:id/measure/stage/:order/pos', sessionAuth, tenderCheck, 'stageController.getStagePosData');
     app.post('/tender/:id/measure/stage/:order/update', sessionAuth, tenderCheck, 'stageController.updateStageData');
+    app.post('/tender/:id/measure/stage/:order/valid-change', sessionAuth, tenderCheck, 'stageController.searchValidChange');
     // 中间计量
     app.get('/tender/:id/measure/stage/:order/detail', sessionAuth, tenderCheck, 'stageController.detail');
     app.post('/tender/:id/measure/stage/:order/detail/build', sessionAuth, tenderCheck, 'stageController.buildDetailData');

+ 16 - 0
app/service/change_audit.js

@@ -245,6 +245,22 @@ module.exports = app => {
 
             return result;
         }
+
+        /**
+         * 获取 审核人 待审批的() 变更令列表
+         * @param uid
+         * @returns {Promise<void>}
+         */
+        async getAuditChange(uid) {
+            const sql = 'SELECT ca.`uid`, ca.`times`, ca.`usite`, ca.`usort`, ca.`tid`, ca.`cid`, ca.`sin_time`, ' +
+                '    c.`code` As `ccode`, c.`name` As `cname`,' +
+                '    t.`name`, t.`type`, t.`user_id` ' +
+                '  FROM ?? AS ca, ?? AS c, ?? As t ' +
+                '  WHERE ca.`uid` = ? and ca.`status` = ?' +
+                '    and ca.`cid` = c.`cid` and ca.`tid` = t.`id`';
+            const sqlParam = [this.tableName, this.ctx.service.change.tableName, this.ctx.service.tender.tableName, uid, 2];
+            return await this.db.query(sql, sqlParam);
+        }
     }
 
     return ChangeAudit;

+ 0 - 1
app/service/stage_pos.js

@@ -233,7 +233,6 @@ module.exports = app => {
                     refreshData = await this._addStagePosData(transaction, data.updateData);
                 } else if (data.updateType === 'update') {
                     refreshData = await this._updateStagePosData(transaction, data.updateData);
-                    console.log(refreshData);
                 } else if (data.updateType === 'delete') {
                     if (!data.updateData || data.updateData.length === 0) {
                         throw '提交数据错误';

+ 2 - 2
app/view/change/info_modal.ejs

@@ -273,9 +273,9 @@
                                 <li class="list-group-item">
                                     <% if (al.usite === 0 && al.status === 2) { %>
                                     <span class="pull-right">重新上报中</span>
-                                    <% } else if (al.usite === 0 && al.status === 3 && a.times === 1) { %>
+                                    <% } else if (al.usite === 0 && al.status === 3 && al.times === 1) { %>
                                     <span class="text-success pull-right">上报</span>
-                                    <% } else if (al.usite === 0 && al.status === 3 && a.times !== 1) { %>
+                                    <% } else if (al.usite === 0 && al.status === 3 && al.times !== 1) { %>
                                     <span class="text-success pull-right">重新上报</span>
                                     <% } else if (al.usite !== 0 && al.status === 2) { %>
                                     <span class="pull-right">审批中</span>

+ 18 - 0
app/view/dashboard/index.ejs

@@ -33,6 +33,24 @@
                     </div>
                 </li>
                 <% } %>
+                <% for (const change of auditChanges) { %>
+                <li class="media">
+                    <img class="mr-3" src="public/images/avatar.png">
+                    <div class="media-body">
+                        <span class="pull-right text-muted"><%- change.sin_time.toLocaleString() %></span>
+                        <h5 class="mt-0"><%- ctx.session.sessionUser.name %><small class="ml-3 text-muted"><%- change.role %></small></h5>
+                        <p>
+                            <a href="/tender/<%- change.tid %>"><%- change.name %></a>
+                            变更令 <%- change.ccode %>
+                            <% if (change.sstatus === acChange.status.backnew) { %><span style="color: indianred">被退回</span> <% } %>
+                            需要您
+                            <a href="/tender/<%- change.tid %>/change/<%- change.cid %>/info">
+                                <% if (change.sstatus === acChange.status.backnew) { %>重新<% } %>审批
+                            </a>。
+                        </p>
+                    </div>
+                </li>
+                <% } %>
             </ul>
         </div>
         <div class="c-header mt-4">

+ 5 - 2
app/view/measure/stage_modal.ejs

@@ -14,11 +14,11 @@
                 </div>
                 <div class="form-group">
                     <label>计量年月</label>
-                    <input class="datepicker-here form-control" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text" name="date">
+                    <input class="datepicker-here form-control" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text" name="date" autocomplete="off">
                 </div>
                 <div class="form-group">
                     <label>开始-截止日期</label>
-                    <input class="datepicker-here form-control" placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text" name="period">
+                    <input class="datepicker-here form-control" placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text" name="period" autocomplete="off">
                 </div>
             </div>
             <div class="modal-footer">
@@ -159,4 +159,7 @@
             $('#edit').modal('hide');
         });
     });
+    $('.datepicker-here').datepicker({
+        autoClose: true,
+    });
 </script>

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

@@ -264,6 +264,7 @@
         </div>
     </div>
 </div>
+<img src="/public/images/ellipsis_horizontal.png" id="ellipsis-icon">
 <script>
     GC.Spread.Sheets.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";
 </script>