瀏覽代碼

1. 批量插入清单部位,各列对齐方式
2. 部位明细,删除数量,实时计算问题
3. 项目管理,时间格式

MaiXinRong 6 年之前
父節點
當前提交
19ae945117
共有 4 個文件被更改,包括 23 次插入11 次删除
  1. 12 9
      app/public/js/ledger.js
  2. 8 0
      app/public/js/spreadjs_rela/spreadjs_zh.js
  3. 1 1
      app/public/js/tender_list_manage.js
  4. 2 1
      app/service/pos.js

+ 12 - 9
app/public/js/ledger.js

@@ -1093,11 +1093,11 @@ $(document).ready(function() {
             // 初始化 清单编号窗口 参数
             this.qdSpreadSetting = {
                 cols: [
-                    {title: '编号', field: 'code', width: 80, formatter: '@'},
-                    {title: '名称', field: 'name', width: 120, formatter: '@'},
-                    {title: '单位', field: 'unit', width: 50, formatter: '@'},
-                    {title: '单价', field: 'unit_price', width: 50},
-                    {title: '图册号', field: 'name', width: 60, formatter: '@'},
+                    {title: '编号', field: 'code', hAlign: 0, width: 80, formatter: '@'},
+                    {title: '名称', field: 'name', hAlign: 0, width: 120, formatter: '@'},
+                    {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
+                    {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
+                    {title: '图册号', field: 'name', hAlign: 0, width: 60, formatter: '@'},
                 ],
                 emptyRows: this.billsCount,
                 headRows: 1,
@@ -1107,8 +1107,8 @@ $(document).ready(function() {
             // 初始化 部位数量复核表 参数
             this.posSpreadSetting = {
                 cols: [
-                    {title: '部位', field: 'bw', width: 80, formatter: '@'},
-                    {title: '图册号', field: 'drawingCode', formatter: '@', width: 60},
+                    {title: '部位', field: 'bw', hAlign: 0, width: 80, formatter: '@'},
+                    {title: '图册号', field: 'drawingCode', hAlign: 0, formatter: '@', width: 60},
                 ],
                 emptyRows: this.posCount,
                 headRows: 1,
@@ -1116,7 +1116,7 @@ $(document).ready(function() {
             };
             for (let iNum = 1; iNum <= this.billsCount; iNum++) {
                 this.posSpreadSetting.cols.push(
-                    {title: '清单' + iNum, field: 'bills' + iNum, width: 50}
+                    {title: '清单' + iNum, field: 'bills' + iNum, hAlign: 2, width: 50}
                 )
             }
             this.posSpread = SpreadJsObj.createNewSpread($('.batch-l-b', this.obj)[0]);
@@ -1136,6 +1136,7 @@ $(document).ready(function() {
             // 初始化 清单编号、部位数量复核表 表格
             this.initView();
             SpreadJsObj.initSheet(this.dealSpread.getActiveSheet(), this.dealSpreadSetting);
+            SpreadJsObj.refreshColumnAlign(this.dealSpread.getActiveSheet());
             // 拉取签约清单数据
             if (dealBills) {
                 SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
@@ -1198,6 +1199,7 @@ $(document).ready(function() {
             // 初始化 清单编号
             const qdSheet = this.qdSpread.getActiveSheet();
             SpreadJsObj.initSheet(qdSheet, this.qdSpreadSetting);
+            SpreadJsObj.refreshColumnAlign(qdSheet);
             // 清理原有数据
             SpreadJsObj.beginMassOperation(qdSheet);
             qdSheet.clear(0, 0, qdSheet.getRowCount(), qdSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
@@ -1209,6 +1211,7 @@ $(document).ready(function() {
             // 初始化 部位数量复核表
             const posSheet = this.posSpread.getActiveSheet();
             SpreadJsObj.initSheet(posSheet, this.posSpreadSetting);
+            SpreadJsObj.refreshColumnAlign(posSheet);
             // 清理原有数据
             SpreadJsObj.beginMassOperation(posSheet);
             posSheet.setColumnWidth(0, 45, GC.Spread.Sheets.SheetArea.rowHeader);
@@ -1286,7 +1289,7 @@ $(document).ready(function() {
     $('#searchAccount').click(() => {
         const data = {
             keyword: $('#searchName').val(),
-        }
+        };
         postData('/search/user', data, (data) => {
             const resultDiv = $('#searchResult');
             if (data) {

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

@@ -627,6 +627,14 @@ const SpreadJsObj = {
         // }
         this.endMassOperation(sheet);
     },
+    refreshColumnAlign: function (sheet) {
+        if (sheet.zh_setting) {
+            for (const iCol in sheet.zh_setting.cols) {
+                const col = sheet.zh_setting.cols[iCol];
+                sheet.getRange(-1, iCol, -1, 1).hAlign(col.hAlign);
+            }
+        }
+    },
     /**
      * 刷新列是否只读
      * @param sheet

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

@@ -248,7 +248,7 @@ function recursiveGetTenderNodeHtml (node, arr) {
     // 创建人
     html.push('<td>', node.user_name, '</td>');
     // 创建时间
-    html.push('<td>', node.create_time ? moment(node.create_time).format('YYYY-MM-DD hh:mm:ss') : '', '</td>');
+    html.push('<td>', node.create_time ? moment(node.create_time).format('YYYY-MM-DD HH:mm:ss') : '', '</td>');
     // 完成期数
     html.push('<td>');
     if (!node.cid) {

+ 2 - 1
app/service/pos.js

@@ -75,7 +75,7 @@ module.exports = app => {
                             d.quantity = this._.round(d.quantity, precision.value);
                         }
                         await transaction.update(this.tableName, d, {tid: tid, id: d.id});
-                        if (d.quantity && op && (result.ledger.update.indexOf(op.lid) === -1)) {
+                        if (d.quantity !== undefined && op && (result.ledger.update.indexOf(op.lid) === -1)) {
                             result.ledger.update.push(op.lid);
                         }
                     }
@@ -88,6 +88,7 @@ module.exports = app => {
                     }
                     const pos = await this.getPosData({tid: tid, id: data.updateData});
                     const ledgerIds = this._.map(pos, 'lid');
+                    console.log(ledgerIds);
                     await transaction.delete(this.tableName, {tid: tid, id: data.updateData});
                     for (const lid of ledgerIds) {
                         await this.ctx.service.ledger.calc(tid, lid, transaction);