Browse Source

字体还原/单据复制功能

zhuth 7 years ago
parent
commit
1a36189a43

+ 9 - 4
frontend/saas-web/app/Application.scss

@@ -83,12 +83,13 @@ body.launching {
 .x-form-text-default,
 .x-column-header,
 .x-grid-item,
-.x-grid-row-summary .x-grid-cell, .x-grid-row-summary .x-grid-rowwrap, .x-grid-row-summary .x-grid-cell-rowbody {
-  font-family: 'pingFangSC-Regular';
+.x-grid-row-summary .x-grid-cell, .x-grid-row-summary .x-grid-rowwrap, .x-grid-row-summary .x-grid-cell-rowbody,
+.x-boundlist-item {
+  // font-family: 'pingFangSC-Regular';
 }
 
 .x-form-item-label-default {
-  font-family: PingFangSC-Medium;
+  // font-family: PingFangSC-Medium;
   font-size: 14px;
   color: #505363;
   text-align: right;
@@ -133,6 +134,10 @@ body.launching {
 .x-keyboard-mode .x-btn-focus.x-btn-default-toolbar-small {
   background: #34BAF6;
   opacity: 0.72;
+  box-shadow: none;
+}
+.x-keyboard-mode .x-btn-focus.x-btn-over.x-btn-default-toolbar-small {
+  box-shadow: none;
 }
 
 .x-btn-wrap-default-toolbar-small.x-btn-arrow-right:after {
@@ -187,7 +192,7 @@ body.launching {
   letter-spacing: 0;
   text-align: center;
   line-height: 20px;
-  font-family: PingFangSC-Medium;
+  // font-family: PingFangSC-Medium;
   font-weight: normal;
 }
 

+ 4 - 4
frontend/saas-web/app/util/FormUtil.js

@@ -170,6 +170,7 @@ Ext.define('saas.util.FormUtil', {
             me.loadData(form);
         })
         .catch(function(response) {
+            showToast('错误:' + response.message);
             console.error(response);
         });
 
@@ -226,10 +227,9 @@ Ext.define('saas.util.FormUtil', {
                         var o = {};
                         o[form._codeField] = code;
 
-                        var formData = {
-                            main: o
-                        };
-                        Ext.Array.each(detailGrids, function(grid, index) {
+                        var formData = form.initData || {main: {}};
+                        Ext.apply(formData.main, o);
+                        form.initData || Ext.Array.each(detailGrids, function(grid, index) {
                             var detno = 0;
                             var detnoColumn = grid.detnoColumn;
                             var datas = [];

+ 7 - 0
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -63,6 +63,13 @@ Ext.define('saas.view.core.form.FormPanel', {
                 hidden: '{!id}'
             },
             handler: 'add'
+        }, {
+            xtype: 'button',
+            text: '复制',
+            handler: 'onCopy',
+            bind: {
+                hidden: '{!'+ me._idField + '}',
+            }
         }, {
             xtype: 'button',
             text: '保存',

+ 8 - 2
frontend/saas-web/app/view/core/form/FormPanel.scss

@@ -5,7 +5,10 @@
         color: #A2A2A2;
         letter-spacing: 0.72px;
         text-align: left;
-        font: 400 18px/16px 'PingFangSC-Regular';
+        font-size: 18px;
+        line-height: 16px;
+        font-weight: 400;
+        // font: 400 18px/16px 'PingFangSC-Regular';
     }
     .x-codeeditor {
         top: -2px !important;
@@ -22,7 +25,10 @@
                 letter-spacing: 0.72px;
                 font-size: 18px;
                 min-height: inherit;
-                font: 400 18px/16px 'PingFangSC-Regular';
+                font-size: 18px;
+                line-height: 16px;
+                font-weight: 400;
+                // font: 400 18px/16px 'PingFangSC-Regular';
             }
         }
     }

+ 47 - 0
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -20,6 +20,53 @@ Ext.define('saas.view.core.form.FormPanelController', {
         var id = form.xtype + '-add';
         openTab(form.xtype,'新增' + form._title, id);
     },
+
+    onCopy: function() {
+        var me = this;
+        var form = this.getView();
+        var id = form.xtype + '-add';
+
+        var formData = me.initCopyData(form.getFormData());
+
+        openTab(form.xtype,'新增' + form._title, id, {initData: formData});
+    },
+
+    initCopyData: function(formData) {
+        var form = this.getView();
+        var detailCount = form.detailCount;
+        var main = formData.main;
+        var auditTexts = form.auditTexts;
+
+        // 单号、id清空
+        main[form._idField] = 0;
+        main[form._codeField] = '';
+        // 单据状态为录入状态(未审核)
+        main[form._statusCodeField] = auditTexts.unAuditCode;
+        main[form._statusField] = auditTexts.unAuditText;
+
+        for(var k in main) {
+            // 主表日期改为当前日期
+            if(isDateString(main[k])) {
+                main[k] = Ext.Date.format(new Date, 'Y-m-d H:i:s');
+            }
+        }
+
+        for(var j = 0; j < detailCount; j++) {
+            var detail = formData['detail' + j];
+            for(var x = 0; x < detail.length; x ++) {
+                var d = detail[x];
+
+                for(var k in d) {
+                    // 从表日期清空
+                    if(isDateString(main[k])) {
+                        main[k] = '';
+                    }
+                }
+            }
+        }
+
+        return formData;
+    },
     
     delete: function(){
         var me = this;

+ 1 - 1
frontend/saas-web/app/view/main/Main.scss

@@ -72,7 +72,7 @@ $treelist-nav-ui: (
         }
 
         .logo-text {
-            font-family: 'pingFangSC-Regular';
+            // font-family: 'pingFangSC-Regular';
             font-size: 18px;
             color: #FFFFFF;
             text-align: left;

+ 34 - 17
frontend/saas-web/overrides/i18n.js

@@ -25,23 +25,6 @@ function openTab(xtype, title, id, config) {
     }
 }
 
-/**
- * 显示toast提示
- * @param content: 内容
- * @param title: 标题
- * 
- */
-function showToast(content, title) {
-    Ext.toast({
-        html: content,
-        title: title,
-        closable: false,
-        align: 't',
-        slideDUration: 400,
-        maxWidth: 400
-    });
-}
-
 /**
  * 重设tab标题
  */
@@ -61,6 +44,29 @@ function getCurrentTab() {
     return currentTab;
 }
 
+/**
+ * 显示toast提示(无需用户操作)
+ * @param content: 内容
+ * @param title: 标题
+ * 
+ */
+function showToast(content, title) {
+    Ext.toast({
+        html: content,
+        title: title,
+        closable: false,
+        align: 't',
+        slideDUration: 400,
+        maxWidth: 400
+    });
+}
+
+/**
+ * 显示警告(需要选择是、否)
+ * @param title: 标题
+ * @param message: 内容
+ * @return : Promise
+ */
 function showConfirm(title, message) {
     return new Ext.Promise(function (resolve, reject) {
         Ext.MessageBox.confirm(title, message, function(buttonId) {
@@ -88,4 +94,15 @@ function deleteWarn(msg, fn){
          fn: fn,
          renderTo: Ext.getCmp('main-tab-panel').getActiveTab().getEl()
 	});
+}
+
+/**
+ * 判断字符串是否日期字符串
+ * 需要满足格式 yyyy-MM-dd hh:mm:ss
+ * 或者yyyy-M-d h:m:s
+ * @param str: 字符串
+ * @returns Boolean
+ */
+function isDateString(str) {
+    return (/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/).test(str);
 }