Bläddra i källkod

中间计量表号

MaiXinRong 3 år sedan
förälder
incheckning
c1c5f47ae0
5 ändrade filer med 14 tillägg och 13 borttagningar
  1. 5 1
      app/lib/stage_im.js
  2. 3 3
      app/public/js/stage.js
  3. 5 7
      app/public/js/stage_im.js
  4. 1 1
      app/service/stage.js
  5. 0 1
      app/view/stage/modal.ejs

+ 5 - 1
app/lib/stage_im.js

@@ -321,6 +321,7 @@ class StageIm {
                         (!im.pid || im.pid === d.pid) &&
                         (!im.pos_name || im.pos_name === d.pos_name);
                 });
+                break;
             case imType.zl.value:
                 cd = this._.find(this.details, function (d) {
                     return im.lid === d.lid &&
@@ -331,6 +332,7 @@ class StageIm {
                         (!im.pid || im.pid === d.pid) &&
                         (!im.pos_name || im.pos_name === d.pos_name);
                 });
+                break;
             case imType.bw.value:
                 cd = this._.find(this.details, function (d) {
                     return im.lid === d.lid &&
@@ -341,6 +343,7 @@ class StageIm {
                         (!im.pid || im.pid === d.pid) &&
                         (!im.pos_name || im.pos_name === d.pos_name);
                 });
+                break;
             case imType.bb.value:
                 cd = this._.find(this.details, function (d) {
                     return im.lid === d.lid &&
@@ -349,6 +352,7 @@ class StageIm {
                         (!im.pid || im.pid === d.pid) &&
                         (!im.pos_name || im.pos_name === d.pos_name);
                 });
+                break;
         }
         if (cd) {
             im.custom_define = im.custom_define !== null ? (cd.custom_define ? cd.custom_define.split(',') : []) : this.imFields;
@@ -1019,7 +1023,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 + this.stage.im_start_num + 1, 3);
+            im.im_code = pre + this._getNumberFormat(this.stage.order, 2) + this.splitChar + this._getNumberFormat(i + this.stage.im_start_num, 3);
             if (im.gclBills) {
                 for (const b of im.gclBills) {
                     b.im_code = im.im_code;

+ 3 - 3
app/public/js/stage.js

@@ -2768,7 +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);
+                $('#im-start-num').val(stage.im_start_num ? stage.im_start_num : '');
                 const typeArr = $('div[name="im-type"]');
                 for (const t of typeArr) {
                     if (parseInt($(t).attr('im-type')) === stage.im_type) {
@@ -2783,9 +2783,9 @@ $(document).ready(() => {
                 let startNum;
                 try {
                     startNum = parseInt($('#im-start-num').val());
-                    if (startNum <= 0) throw '请输入正整数';
+                    if (!startNum || startNum <= 0) throw '起始编号请输入正整数';
                 } catch (err) {
-                    toastr.error("中间计量表号起始编号请输入正整数");
+                    toastr.error("起始编号请输入正整数");
                     return;
                 }
                 const chooseType = _.find($('div[name="im-type"]', '#im-type'), function (it) {

+ 5 - 7
app/public/js/stage_im.js

@@ -313,7 +313,6 @@ const stageIm = (function () {
         if (cd) loadCustomDetail(im, cd);
     }
 
-
     function checkBbCustomDetail(im) {
         const cd = _.find(details, function (d) {
             return im.lid === d.lid &&
@@ -916,19 +915,18 @@ const stageIm = (function () {
             getCalcMemo(im);
             getChangeInfo(im);
             switch (stage.im_type) {
-                case imType.tz.value: checkTzCustomDetail(im);
-                case imType.zl.value: checkZlCustomDetail(im);
-                case imType.bw.value: checkBwCustomDetail(im);
-                case imType.bb.value: checkBbCustomDetail(im);
+                case imType.tz.value: checkTzCustomDetail(im); break;
+                case imType.zl.value: checkZlCustomDetail(im); break;
+                case imType.bw.value: checkBwCustomDetail(im); break;
+                case imType.bb.value: checkBbCustomDetail(im); break;
             }
         }
     }
 
     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 + stage.im_start_num + 1, 3);
+            im.im_code = pre + getNumberFormat(stage.order, 2) + splitChar + getNumberFormat(i + stage.im_start_num, 3);
         }
     }
 

+ 1 - 1
app/service/stage.js

@@ -427,7 +427,7 @@ module.exports = app => {
         async buildDetailData(tenderId, order, data) {
             const conn = await this.db.beginTransaction();
             try {
-                await conn.update(this.tableName, { im_type: data.im_type, im_pre: data.im_pre }, { where: { tid: tenderId, order } });
+                await conn.update(this.tableName, { im_type: data.im_type, im_pre: data.im_pre , im_start_num: data.im_start_num }, { where: { tid: tenderId, order } });
                 // to do 生成中间计量数据
                 await conn.commit();
             } catch (err) {

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

@@ -277,7 +277,6 @@
                         </div>
                         <input type="Number" class="form-control" id="im-start-num" maxlength="10" style="height: 30px">
                     </div>
-                    <label class="text-warning pull-right">设置为n,将从n+1开始编号</label>
                 </div>
                 <div class="form-group">
                     <label> </label>