Pārlūkot izejas kodu

Merge branch 'dev4im' into dev

Conflicts:
	sql/update.sql
MaiXinRong 3 gadi atpakaļ
vecāks
revīzija
89a7bcbf09

+ 1 - 1
app/lib/stage_im.js

@@ -1019,7 +1019,7 @@ class StageIm {
         // 生成数据(需要缓存,并清理缓存)
         const pre = (this.stage.im_pre && this.stage.im_pre !== '') ? this.stage.im_pre + this.splitChar : '';
         for (const [i, im] of this.ImData.entries()) {
-            im.im_code = pre + this._getNumberFormat(this.stage.order, 2) + this.splitChar + this._getNumberFormat(i + 1, 3);
+            im.im_code = pre + this._getNumberFormat(this.stage.order, 2) + this.splitChar + this._getNumberFormat(i + this.stage.im_start_num + 1, 3);
             if (im.gclBills) {
                 for (const b of im.gclBills) {
                     b.im_code = im.im_code;

+ 1 - 0
app/middleware/stage_check.js

@@ -158,6 +158,7 @@ module.exports = options => {
                     }
                 }
             }
+            console.log(this.stage);
             yield next;
         } catch (err) {
             this.helper.log(err);

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

@@ -2768,6 +2768,7 @@ $(document).ready(() => {
                     $('i', obj).remove();
                 }
                 $('#im-pre').val(stage.im_pre ? stage.im_pre : '');
+                $('#im-start-num').val(stage.im_start_num ? stage.im_start_num : 0);
                 const typeArr = $('div[name="im-type"]');
                 for (const t of typeArr) {
                     if (parseInt($(t).attr('im-type')) === stage.im_type) {
@@ -2779,16 +2780,26 @@ $(document).ready(() => {
             });
             // 提交 中间计量模式
             $('#choose-ok').click(() => {
+                let startNum;
+                try {
+                    startNum = parseInt($('#im-start-num').val());
+                    if (startNum <= 0) throw '请输入正整数';
+                } catch (err) {
+                    toastr.error("中间计量表号起始编号请输入正整数");
+                    return;
+                }
                 const chooseType = _.find($('div[name="im-type"]', '#im-type'), function (it) {
                     return it.style.cursor !== 'pointer';
                 });
                 const data = {
                     im_type: parseInt($(chooseType).attr('im-type')),
                     im_pre: $('#im-pre').val(),
+                    im_start_num: startNum,
                 };
                 postData(window.location.pathname + '/detail/build', data, function (result) {
                     stage.im_type = data.im_type;
                     stage.im_pre = data.im_pre;
+                    stage.im_start_num = data.im_start_num;
                     if (stage.im_type === imType.tz.value || stage.im_type === imType.bb.value) {
                         const jlCol = self.spreadSetting.cols.find(function (x) {return x.field === 'jl'});
                         jlCol.title = '本期计量金额';

+ 2 - 1
app/public/js/stage_im.js

@@ -925,9 +925,10 @@ const stageIm = (function () {
     }
 
     function _buildImCode() {
+        console.log(stage);
         pre = (stage.im_pre && stage.im_pre !== '') ? stage.im_pre + splitChar : '';
         for (const [i, im] of ImData.entries()) {
-            im.im_code = pre + getNumberFormat(stage.order, 2) + splitChar + getNumberFormat(i + 1, 3);
+            im.im_code = pre + getNumberFormat(stage.order, 2) + splitChar + getNumberFormat(i + stage.im_start_num + 1, 3);
         }
     }
 

+ 4 - 0
app/view/stage/detail_modal.ejs

@@ -29,6 +29,10 @@
                     <input type="text" class="form-control form-control-sm" value="<%- ctx.stage.im_pre ? ctx.stage.im_pre : '' %>" id="im-pre" maxlength="10">
                 </div>
                 <div class="form-group">
+                    <label>中间计量表号起始编号</label>
+                    <input type="Number" class="form-control form-control-sm" value="<%- ctx.stage.im_start_num ? ctx.stage.im_start_num : '' %>" id="im-start-num" maxlength="10">
+                </div>
+                <div class="form-group">
                     <label> </label>
                     <a  href="#choose2" data-toggle="modal" data-target="#choose2">高级设置</a>
                 </div>

+ 6 - 1
app/view/stage/modal.ejs

@@ -268,8 +268,13 @@
                     <input type="text" class="form-control form-control-sm" value="<%- ctx.stage.im_pre ? ctx.stage.im_pre : '' %>" id="im-pre" maxlength="20">
                 </div>
                 <div class="form-group">
+                    <label>中间计量表号起始编号</label>
+                    <input type="Number" class="form-control form-control-sm" id="im-start-num" maxlength="10">
+                    <label class="text-warning pull-right">设置为n,将从n+1开始编号</label>
+                </div>
+                <div class="form-group">
                     <label> </label>
-                    <a  href="#choose2" data-toggle="modal" data-target="#choose2">高级设置</a>
+                    <a href="#choose2" data-toggle="modal" data-target="#choose2">高级设置</a>
                 </div>
             </div>
             <div class="modal-footer">

+ 3 - 0
sql/update.sql

@@ -276,3 +276,6 @@ CREATE TABLE `zh_s2b_z_log`  (
   `post_time` datetime NULL DEFAULT NULL COMMENT '请求时间',
   PRIMARY KEY (`id`)
 ) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '浙江项目日志表';
+
+ALTER TABLE `zh_stage`
+ADD COLUMN `im_start_num`  int(11) NOT NULL DEFAULT 0 AFTER `im_gather_node`;