瀏覽代碼

预期到货通知单 排版

luoyifan 3 年之前
父節點
當前提交
d685a9a597
共有 3 個文件被更改,包括 34 次插入9 次删除
  1. 18 9
      src/Defaults.ts
  2. 14 0
      src/controls/form.js
  3. 2 0
      src/init.ts

+ 18 - 9
src/Defaults.ts

@@ -1,3 +1,5 @@
+const labelWidth = 70
+
 export const windows = {
     modal: true,
     width: 900,
@@ -11,12 +13,12 @@ export const windows = {
 
 export const date = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const combo = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
     valueField: 'id',
     displayField: 'text',
     autoLoad: true,
@@ -44,27 +46,34 @@ export const comboGridPicker = {
 
 export const numberfield = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const checkbox = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const checkboxgroup = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const radio = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const radiogroup = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
+}
+
+export const form = {
+    margin: '5 5 0 0',
+    defaults: {
+        margin: '0 0 5 0'
+    },
 }
 
 export const grid = {
@@ -92,12 +101,12 @@ export const grid = {
 
 export const search = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
 }
 
 export const text = {
     labelAlign: 'right',
-    labelWidth: 70,
+    labelWidth,
     msgTarget: 'side',
 }
 

+ 14 - 0
src/controls/form.js

@@ -0,0 +1,14 @@
+import _ from 'lodash'
+import {form} from '../Defaults'
+import {baseConfig} from "./base";
+
+export default function () {
+
+    const ct = Ext.form.Panel.prototype.constructor
+    Ext.form.Panel.override({
+        constructor: function (config) {
+            const newConfig = _.defaultsDeep({}, config, baseConfig(config, "cols-container"), form)
+            ct.call(this, newConfig)
+        }
+    });
+}

+ 2 - 0
src/init.ts

@@ -19,6 +19,7 @@ import initCombotree from './controls/input/combotree'
 import initPickerPlus from './controls/input/pickerplus'
 import initCombogrid from './controls/input/combogrid'
 import initRows from './controls/rows'
+import initForm from './controls/form'
 import initCols from './controls/cols'
 import initButton from './controls/button'
 import initStores from './controls/stores'
@@ -115,6 +116,7 @@ export function init() {
     initCombo()
     initRows()
     initCols()
+    initForm()
     initToolbar()
     initSplitter()
     initButton()