فهرست منبع

记录用户列宽调整

MaiXinRong 5 سال پیش
والد
کامیت
cb1193e2a8

+ 8 - 0
app/public/js/gather_stage.js

@@ -61,6 +61,10 @@ $(document).ready(function () {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'spss-gather-stage-bills',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             function checkDiffer(data) {
                 return !checkZero(data.qty_differ) && !checkZero(data.tp_differ);
@@ -82,6 +86,10 @@ $(document).ready(function () {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'spss-gather-stage-bills',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             function checkDiffer(data) {
                 const fieldSufs = sheet.zh_setting.fieldSufs;

+ 8 - 0
app/public/js/gather_tz.js

@@ -61,6 +61,10 @@ $(document).ready(function () {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'spss-gather-tz-bills',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             function checkDiffer(data) {
                 return !checkZero(data.qty_differ) && !checkZero(data.tp_differ);
@@ -82,6 +86,10 @@ $(document).ready(function () {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'spss-gather-tz-pos',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             function checkDiffer(data) {
                 const fieldSufs = sheet.zh_setting.fieldSufs;

+ 8 - 0
app/public/js/ledger_gather.js

@@ -31,6 +31,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'ledger-gather-gcl',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             return data 
                 ? $('#compare-tag')[0].checked && data.compare_differ 
@@ -60,6 +64,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'ledger-gather-leafXmj',
+            colWidth: true,
+        },
     });
     const leafXmjSheet = leafXmjSpread.getActiveSheet();
 

+ 4 - 0
app/public/js/se_bonus.js

@@ -55,6 +55,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: readOnly,
+        localCache: {
+            key: 'stage-extra-bonus',
+            colWidth: true,
+        },
         imageClick: function (data, hitinfo) {
             if (!data) return;
 

+ 4 - 0
app/public/js/se_jgcl.js

@@ -35,6 +35,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: readOnly,
+        localCache: {
+            key: 'stage-extra-jgcl',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             if (data) {
                 if (data.end_deduct_tp) {

+ 4 - 0
app/public/js/se_other.js

@@ -36,6 +36,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: readOnly,
+        localCache: {
+            key: 'stage-extra-other',
+            colWidth: true,
+        },
         getColor: function (sheet, data, row, col, defaultColor) {
             if (data) {
                 if (data.total_price) {

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

@@ -341,6 +341,34 @@ const SpreadJsObj = {
         this._initSheetHeader(sheet);
         this.endMassOperation(sheet);
     },
+    _rememberColWidth: function (sheet) {
+        sheet.bind(spreadNS.Events.ColumnWidthChanged, function (e, info) {
+            if (!info.sheet.zh_setting) return;
+            const setting = info.sheet.zh_setting;
+            if (!setting.localCache || !setting.localCache.key) return;
+            if (!setting.localCache.colWidthCache) return;
+            const cache = setting.localCache.colWidthCache;
+
+            for (const col of info.colList) {
+                const colSetting = setting.cols[col];
+                if (colSetting && colSetting.field)
+                    cache[colSetting.field] = info.sheet.getColumnWidth(col);
+            }
+            setLocalCache(setting.localCache.key + '-colWidth', JSON.stringify(cache));
+        });
+    },
+    _loadCacheSetting: function (sheet, setting) {
+        if (!setting.localCache || !setting.localCache.key) return;
+        if (setting.localCache.colWidth) {
+            const cache = getLocalCache(setting.localCache.key + '-colWidth');
+            setting.localCache.colWidthCache = cache ? JSON.parse(cache) : {};
+            for (const prop in setting.localCache.colWidthCache) {
+                const col = _.find(setting.cols, {field: prop});
+                if (col) col.width = setting.localCache.colWidthCache[prop];
+            }
+            this._rememberColWidth(sheet);
+        }
+    },
     /**
      * 初始化sheet, 设置sheet.zh_setting, 并初始化表头
      * @param {GC.Spread.Sheets.Worksheet} sheet
@@ -348,6 +376,7 @@ const SpreadJsObj = {
      */
     initSheet: function (sheet, setting) {
         this.beginMassOperation(sheet);
+        this._loadCacheSetting(sheet, setting);
         setting.pos = sheet.getParent().pos;
         if (!setting.tree) setting.tree = {};
         sheet.zh_setting = setting;

+ 12 - 0
app/public/js/stage_change.js

@@ -83,6 +83,10 @@ $(document).ready(() => {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        localCache: {
+            key: 'stage-change',
+            colWidth: true,
+        }
     };
     const changeSpread = SpreadJsObj.createNewSpread($('#bgl-spread')[0]);
     SpreadJsObj.initSheet(changeSpread.getActiveSheet(), changeSpreadSetting);
@@ -112,6 +116,10 @@ $(document).ready(() => {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        localCache: {
+            key: 'stage-change-bills',
+            colWidth: true,
+        }
     };
     const billsSpread = SpreadJsObj.createNewSpread($('#bills-spread')[0]);
     SpreadJsObj.initSheet(billsSpread.getActiveSheet(), billsSpreadSetting);
@@ -130,6 +138,10 @@ $(document).ready(() => {
         defaultRowHeight: 21,
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
+        localCache: {
+            key: 'stage-change-pos',
+            colWidth: true,
+        }
     };
     const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
     SpreadJsObj.initSheet(posSpread.getActiveSheet(), posSpreadSetting);

+ 4 - 0
app/public/js/stage_pay.js

@@ -148,6 +148,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: readOnly,
+        localCache: {
+            key: 'stage-pay',
+            colWidth: true,
+        }
         pos: SpreadJsObj.getObjPos($('#pay-spread')[0]),
     };
     paySpreadSetting.imageClick = function (data) {

+ 8 - 0
app/view/ledger/audit.ejs

@@ -98,5 +98,13 @@
     const measureType = JSON.parse('<%- JSON.stringify(measureType) %>');
     let ledgerSpreadSetting = '<%- ledgerSpreadSetting %>';
     ledgerSpreadSetting = JSON.parse(ledgerSpreadSetting);
+    ledgerSpreadSetting.localCache = {
+        key: 'ledger-bills',
+        colWidth: true,
+    };
     let posSpreadSetting = JSON.parse('<%- posSpreadSetting %>');
+    posSpreadSetting.localCache = {
+        key: 'ledger-pos',
+        colWidth: true,
+    };
 </script>

+ 8 - 0
app/view/ledger/bwtz.ejs

@@ -89,6 +89,10 @@
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'bwtz-xmj',
+            colWidth: true,
+        }
     };
     const unitSpreadSetting = {
         cols: [
@@ -114,6 +118,10 @@
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'bwtz-unit',
+            colWidth: true,
+        }
     };
     const decimal = <%- ctx.tender.info.decimal.tp %>;
 </script>

+ 8 - 0
app/view/ledger/explode.ejs

@@ -178,7 +178,15 @@
     const measureType = JSON.parse('<%- JSON.stringify(measureType) %>');
     let ledgerSpreadSetting = '<%- ledgerSpreadSetting %>';
     ledgerSpreadSetting = JSON.parse(ledgerSpreadSetting);
+    ledgerSpreadSetting.localCache = {
+        key: 'ledger-bills',
+        colWidth: true,
+    };
     let posSpreadSetting = JSON.parse('<%- posSpreadSetting %>');
+    posSpreadSetting.localCache = {
+        key: 'ledger-pos',
+        colWidth: true,
+    };
 </script>
 <% if ((tender.ledger_status === auditConst.status.uncheck || tender.ledger_status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === tender.user_id) { %>
 <script>

+ 8 - 0
app/view/stage/bwtz.ejs

@@ -109,6 +109,10 @@
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'stage-bwtz-xmj',
+            colWidth: true,
+        },
     };
     const unitSpreadSetting = {
         cols: [
@@ -149,6 +153,10 @@
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        localCache: {
+            key: 'stage-bwtz-unit',
+            colWidth: true,
+        },
     };
     const decimal = <%- ctx.tender.info.decimal.tp %>;
 </script>

+ 8 - 0
app/view/stage/compare.ejs

@@ -69,7 +69,15 @@
     //const auditors = JSON.parse(<%- JSON.stringify(ctx.stage.auditors) %>);
     const stage = JSON.parse('<%- JSON.stringify(ctx.stage) %>');
     const ledgerSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
+    ledgerSpreadSetting.localCache = {
+        key: 'stage-compare-bills',
+        colWidth: true,
+    }
     const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
+    posSpreadSetting.localCache = {
+        key: 'stage-compare-pos',
+        colWidth: true,
+    }
     const scCacheKey = 'stage-compare-role-' + stage.tid + '-' + stage.order;
     let scRoles = getLocalCache(scCacheKey);
     scRoles = scRoles ? scRoles.split(',') : [0];

+ 8 - 0
app/view/stage/gather.ejs

@@ -92,6 +92,14 @@
 <script>
     const stage = JSON.parse('<%- JSON.stringify(ctx.stage) %>');
     const gclSpreadSetting = JSON.parse('<%- JSON.stringify(gclSpread) %>');
+    gclSpreadSetting.localCache = {
+        key: 'stage-gather-gcl',
+        colWidth: true,
+    }
     const leafXmjSpreadSetting = JSON.parse('<%- JSON.stringify(leafXmjSpread) %>');
+    leafXmjSpreadSetting.localCache = {
+        key: 'stage-gather-leafXmj',
+        colWidth: true,
+    }
     chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
 </script>

+ 8 - 0
app/view/stage/index.ejs

@@ -565,7 +565,15 @@
     }
     const readOnly = <%- stage.readOnly || stage.revising %>;
     const ledgerSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
+    ledgerSpreadSetting.localCache = {
+        key: 'stage-bills',
+        colWidth: true,
+    }
     const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
+    ledgerSpreadSetting.localCache = {
+        key: 'stage-pos',
+        colWidth: true,
+    }
     const tender = JSON.parse('<%- JSON.stringify(tender) %>');
     const tenderInfo = JSON.parse('<%- JSON.stringify(ctx.tender.info) %>');
     const measureType = JSON.parse('<%- JSON.stringify(measureType) %>');