Переглянути джерело

计量台账,部位明细排序

MaiXinRong 6 роки тому
батько
коміт
14ef2c8e24
2 змінених файлів з 6 додано та 4 видалено
  1. 5 3
      app/public/js/stage.js
  2. 1 1
      app/service/stage_pos.js

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

@@ -386,7 +386,7 @@ $(document).ready(() => {
                 // 变更性质
                 $('select[name=quality]').val(change.quality);
                 // 变更单位
-                $('select[name=company]').html('<option>' + change.company + '</option>');
+                $('select[name=company]').html('<option>' + (change.company ? change.company : '') + '</option>');
                 // 费用承担方
                 $('input[name=charge][value=' + change.charge + ']').prop('checked', true);
                 // 附件
@@ -878,7 +878,8 @@ $(document).ready(() => {
         editEnded: function (e, info) {
             if (info.sheet.zh_setting) {
                 // 未改变过,则直接跳过
-                const posData = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
+                const sortData = info.sheet.zh_data;
+                const posData = sortData ? sortData[info.row] : null;
                 const col = info.sheet.zh_setting.cols[info.col];
                 const orgText = posData ? posData[col.field] : null;
                 if (orgText === info.editingText || ((!orgText || orgText === '') && (info.editingText === ''))) {
@@ -917,7 +918,8 @@ $(document).ready(() => {
                     } else if (!posData) {
                         if (info.editingText !== '') {
                             data.updateType = 'add';
-                            data.updateData = {name: info.editingText, lid: node.id, tid: tender.id};
+                            const order = (!sortData || sortData.length === 0) ? 1 : Math.max(sortData[sortData.length - 1].porder + 1, sortData.length + 1);
+                            data.updateData = {name: info.editingText, lid: node.id, tid: tender.id, porder: order};
                         } else {
                             return;
                         }

+ 1 - 1
app/service/stage_pos.js

@@ -110,7 +110,7 @@ module.exports = app => {
                 }
                 // 在主表pos中新增数据
                 const p = {
-                    id: this.uuid.v4(), tid: this.ctx.tender.id, lid: d.lid, name: d.name,
+                    id: this.uuid.v4(), tid: this.ctx.tender.id, lid: d.lid, name: d.name, porder: d.porder,
                     add_stage: this.ctx.stage.id,
                     add_times: this.ctx.stage.curTimes,
                     add_user: this.ctx.session.sessionUser.accountId,