Browse Source

调用变更令窗口调整

MaiXinRong 2 years ago
parent
commit
dd651f4030
1 changed files with 16 additions and 7 deletions
  1. 16 7
      app/public/js/stage.js

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

@@ -358,13 +358,7 @@ $(document).ready(() => {
             // 初始化 清单编号窗口 参数
             this.spreadSetting = {
                 cols: [
-                    {title: '已用', field: '', width: 45, formatter: '@', cellType: 'image', readOnly: true, hAlign: 1, indent: 14, img: function (data) {
-                        if (data.uamount && !checkZero(data.uamount)) {
-                            return $('#icon-ok')[0];
-                        } else {
-                            return null;
-                        }
-                    }},
+                    {title: '已用', field: 'select', width: 45, formatter: '@', cellType: 'checkbox', hAlign: 1, indent: 14, getValue: function (data) {return data.uamount && !checkZero(data.uamount);}},
                     {title: '变更令号', field: 'p_code', width: 100, formatter: '@', readOnly: true, hAlign: 0, },
                     {title: '名称', field: 'name', width: 120, formatter: '@', readOnly: true, hAlign: 0,},
                     {title: '变更部位', field: 'b_bwmx', width: 100, formatter: '@', readOnly: true, hAlign: 0,},
@@ -413,6 +407,8 @@ $(document).ready(() => {
             this.spread.bind(spreadNS.Events.EditEnded, function (e, info) {
                 if (info.sheet.zh_setting) {
                     const col = info.sheet.zh_setting.cols[info.col];
+                    if (col.cellType === 'checkbox') return;
+
                     const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
                     const node = sortData[info.row];
                     node[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
@@ -432,6 +428,19 @@ $(document).ready(() => {
                     SpreadJsObj.reLoadRowData(sheet, info.cellRange.row, sel.cellRange.rowCount);
                 }
             });
+            this.spread.bind(spreadNS.Events.ButtonClicked, function(e, info) {
+                if (!info.sheet.zh_setting) return;
+
+                const col = info.sheet.zh_setting.cols[info.col];
+                if (col.cellType === 'checkbox') {
+                    if (info.sheet.isEditing()) {
+                        info.sheet.endEdit(true);
+                    }
+                    const select = info.sheet.zh_data[info.row];
+                    select.uamount = select.uamount ? 0 : select.vamount;
+                    SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
+                }
+            });
             SpreadJsObj.addDeleteBind(this.spread, function (sheet) {
                 if (sheet.zh_setting) {
                     const sel = sheet.getSelections()[0];