{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [
   {
    "configs": {
     "dialog": "true",
     "itemId": "editWin",
     "closeAction": "hide",
     "width": "700"
    },
    "expanded": true,
    "children": [{
     "configs": {
      "itemId": "panel1",
      "width": "700",
      "autoScroll": "true"
     },
     "expanded": false,
     "children": [
      {
       "configs": {
        "itemId": "fieldset1",
        "title": "基本属性"
       },
       "expanded": false,
       "children": [{
        "configs": {
         "layout": "absolute",
         "itemId": "panel1",
         "width": "678",
         "style": "border:0px",
         "height": "200"
        },
        "expanded": true,
        "children": [
         {
          "configs": {
           "itemId": "FIELD_NAME",
           "fieldLabel": "字段名",
           "x": "8",
           "width": "200",
           "y": "8",
           "displayField": "NAME",
           "valueField": "COD",
           "height": "22"
          },
          "expanded": false,
          "children": [{
           "configs": {
            "itemId": "store",
            "url": "m?xwl=dev/wbTableEdit/select"
           },
           "expanded": false,
           "children": [],
           "type": "store",
           "events": {"beforeload": "\
var tableName = app.grid1.tableName;\
operation.params.TABLE_NAME = tableName;\
"}
          }],
          "type": "combo"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MINLENGTHTEXT",
           "lableWidth": " 80",
           "fieldLabel": "最小长度提示",
           "width": "201",
           "x": "224",
           "y": "94",
           "height": "22"
          },
          "expanded": true,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "TABLE_NAME",
           "lableWidth": " 80",
           "hidden": "true",
           "fieldLabel": "表名",
           "width": "201",
           "x": "224",
           "y": "204",
           "disabled": "true",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "LINK_TO",
           "lableWidth": " 80",
           "fieldLabel": "链接",
           "width": "200",
           "x": "440",
           "y": "122",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "DISP_TEXT",
           "lableWidth": " 80",
           "fieldLabel": "显示标题",
           "width": "201",
           "x": "8",
           "y": "36",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "DISP_WIDTH",
           "lableWidth": " 80",
           "fieldLabel": "显示宽度",
           "width": "201",
           "x": "224",
           "y": "36",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "FIELD_SIZE",
           "lableWidth": " 80",
           "fieldLabel": "字段长度",
           "width": "200",
           "x": "440",
           "y": "94",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "VALIDATOR",
           "lableWidth": " 80",
           "fieldLabel": "验证函数",
           "width": "201",
           "x": "224",
           "y": "122",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "ORDERNO",
           "lableWidth": " 80",
           "fieldLabel": "排序",
           "width": "201",
           "x": "440",
           "y": "150",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MAXLENGTH",
           "lableWidth": " 80",
           "fieldLabel": "最大长度",
           "width": "200",
           "x": "8",
           "y": "64",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MAXLENGTHTEXT",
           "lableWidth": " 80",
           "fieldLabel": "最大长度提示",
           "width": "201",
           "x": "224",
           "y": "64",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MINLENGTH",
           "lableWidth": " 80",
           "fieldLabel": "最小长度",
           "width": "200",
           "x": "8",
           "y": "94",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "itemId": "TYPE",
           "pickList": "[['combo','combo'],['number','number'],['text','text'],['datetime','datetime'],['date','date'],['check','check'],['textarea','textarea']]\
",
           "fieldLabel": "控件类型",
           "width": "201",
           "x": "224",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "combo",
          "events": {"select": "if(this.value==\"number\")\
  app.fieldset3.show();\
else if (this.value==\"text\"){\
  app.fieldset3.hide();\
}\
else if (this.value==\"combo\"){\
    app.fieldset3.hide();\
}\
 "}
         },
         {
          "configs": {
           "itemId": "VTYPE",
           "pickList": "[['alphanum','alphanum'],['alpha','alpha'],['email','email'],['url','url']]",
           "fieldLabel": "值类型",
           "width": "201",
           "x": "8",
           "y": "122",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "combo"
         },
         {
          "configs": {
           "itemId": "ALLOW_BLANK",
           "boxLabel": "允许为空",
           "x": "440",
           "width": "120",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         },
         {
          "configs": {
           "itemId": "AUTO_WRAP",
           "boxLabel": "自动换行",
           "x": "440",
           "width": "120",
           "y": "36",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         },
         {
          "configs": {
           "itemId": "READ_ONLY",
           "boxLabel": "只读",
           "x": "560",
           "width": "120",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "DISP_FORMAT",
           "lableWidth": " 80",
           "fieldLabel": "显示格式",
           "width": "201",
           "x": "224",
           "y": "150",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "RENDERER",
           "lableWidth": " 80",
           "fieldLabel": "显示函数",
           "width": "200",
           "x": "8",
           "y": "150",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "itemId": "LISTABLE",
           "boxLabel": "列表显示",
           "x": "560",
           "width": "120",
           "y": "36",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         },
         {
          "configs": {
           "itemId": "EDITABLE",
           "boxLabel": "可编辑",
           "x": "440",
           "width": "120",
           "y": "64",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         },
         {
          "configs": {
           "itemId": "ISFORM",
           "boxLabel": "FROM表单",
           "x": "560",
           "width": "120",
           "y": "64",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "check"
         }
        ],
        "type": "panel"
       }],
       "type": "fieldset"
      },
      {
       "configs": {
        "itemId": "fieldset2",
        "hidden": "false",
        "title": "下拉属性"
       },
       "expanded": true,
       "children": [{
        "configs": {
         "layout": "absolute",
         "itemId": "panel1",
         "split": "true",
         "width": "759",
         "height": "72"
        },
        "expanded": true,
        "children": [
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "KEY_NAME",
           "lableWidth": " 80",
           "fieldLabel": "键名称",
           "width": "201",
           "x": "440",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "itemId": "URL",
           "fieldLabel": "URL",
           "width": "417",
           "x": "8",
           "y": "8",
           "height": "22"
          },
          "expanded": true,
          "children": [{
           "configs": {
            "itemId": "pickComp",
            "rootVisible": "false",
            "height": "250"
           },
           "expanded": true,
           "children": [{
            "configs": {
             "itemId": "store",
             "fields": "['text','path','inframe','pageLink']",
             "url": "m?xwl=dev/wbTableEdit/select-tree"
            },
            "expanded": false,
            "children": [],
            "type": "treestore",
            "events": {"beforeload": "operation.params.path = operation.node.data.path;"}
           }],
           "type": "tree",
           "events": {"itemclick": "if (record.isLeaf()) {\
  var picker = this.ownerCmp;\
  picker.setValue(Wb.getSection(record.getPath('text'), '/', 2));\
  picker.collapse();\
}"}
          }],
          "type": "picker"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "PARAMS",
           "lableWidth": " 80",
           "fieldLabel": "参数",
           "width": "417",
           "x": "8",
           "y": "36",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         }
        ],
        "type": "panel"
       }],
       "type": "fieldset"
      },
      {
       "configs": {
        "itemId": "fieldset3",
        "hidden": "false",
        "title": "数值属性"
       },
       "expanded": true,
       "children": [{
        "configs": {
         "layout": "absolute",
         "itemId": "panel1",
         "split": "true",
         "width": "640",
         "height": "88"
        },
        "expanded": true,
        "children": [
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "DECIMAL_PRECISION",
           "lableWidth": " 80",
           "fieldLabel": "小数位数",
           "width": "201",
           "x": "424",
           "y": "40",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MAXVALUE",
           "lableWidth": " 80",
           "fieldLabel": "最大值",
           "width": "200",
           "x": "8",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MAXTEXT",
           "lableWidth": " 80",
           "fieldLabel": "最大值提示",
           "width": "201",
           "x": "216",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MINVALUE",
           "lableWidth": " 80",
           "fieldLabel": "最小值",
           "width": "201",
           "x": "8",
           "y": "40",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "MINTEXT",
           "lableWidth": " 80",
           "fieldLabel": "最小值提示",
           "width": "201",
           "x": "216",
           "y": "40",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "text"
         },
         {
          "configs": {
           "lableAlign": " right",
           "itemId": "ALLOWDECIMALS",
           "lableWidth": " 80",
           "fieldLabel": "允许小数",
           "keyName": "bool",
           "width": "200",
           "x": "424",
           "y": "8",
           "height": "22"
          },
          "expanded": false,
          "children": [],
          "type": "combo"
         }
        ],
        "type": "panel"
       }],
       "type": "fieldset"
      }
     ],
     "type": "panel"
    }],
    "type": "window",
    "events": {"ok": "var values = Wb.getValue(app.editWin);\
if (app.isEdit) {\
  //点击修改按钮的处理过程\
  Wb.request({\
    url: 'm?xwl=dev/wbTableEdit/update',\
    params: Wb.applyIf(values, Wb.getData(app.selRec, true)), //合并窗口和记录数据作为参数，后者为默认值\
    success: function() {\
      //把窗口数据更新到选择记录中\
      Wb.update(app.selRec, values);\
      //隐藏对话框，在模块关闭时自动销毁对话框\
      app.editWin.close();\
    }\
  });\
} else {\
  //点击添加按钮的处理过程\
  Wb.request({\
    url: 'm?xwl=dev/wbTableEdit/insert',\
    out: app.editWin,\
    success: function(resp) {\
      //把服务器返回的数据合并窗口数据（公司名称等数据）添加到表格中\
        var ms=Wb.apply( values,Wb.decode(resp.responseText));\
     \
      Wb.add(app.grid1, Wb.apply(Wb.decode(resp.responseText), values));\
      //隐藏对话框，在模块关闭时自动销毁对话框\
      app.editWin.close();\
    }\
  });\
}"}
   },
   {
    "configs": {
     "layout": "border",
     "itemId": "viewport1"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "itemId": "tableTree",
       "split": "true",
       "plugins": "{ptype:'bufferedrenderer'}",
       "width": "200",
       "region": "west",
       "title": "数据库列表",
       "iconCls": "db_icon",
       "collapsible": "true",
       "rootVisible": "false"
      },
      "expanded": true,
      "children": [
       {
        "configs": {
         "itemId": "store",
         "fields": "['text', 'jndi', 'type', 'schema', 'table']",
         "url": "m?xwl=dev/dict/get-tree"
        },
        "expanded": false,
        "children": [],
        "type": "treestore",
        "events": {"beforeload": "operation.params = operation.node.data;"}
       },
       {
        "configs": {"itemId": "tools"},
        "expanded": true,
        "children": [
         {
          "configs": {
           "itemId": "refreshBtn",
           "tooltip": "刷新",
           "tooltype": "refresh"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "Wb.reload(app.tableTree);"}
         },
         {
          "configs": {
           "itemId": "setBtn",
           "tooltip": "切换表名前Schem",
           "tooltype": "gear"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "Ext.suspendLayouts();\
app.tableTree.getRootNode().cascadeBy(function(node) {\
  if (node.isLeaf()) {\
    node.set('text', node.data.table);\
    node.commit();\
  }\
});\
Ext.resumeLayouts(true);"}
         }
        ],
        "type": "array"
       }
      ],
      "type": "tree",
      "events": {
       "selectionchange": "\
\
var tableName, upperTableName, dbName, grid = app.grid1,\
  rec = selected[0];\
if (rec && rec.isLeaf()) {\
  if (grid.disabled)\
    grid.setDisabled(false);\
  dbName = rec.parentNode.data.text;\
  tableName = (dbName == 'default' ? '' : dbName + '.') + rec.data.table; //表名不带schem，如果非默认数据库则带jndi变量名前缀\
  upperTableName = tableName.toUpperCase();\
  grid.tableName = upperTableName;\
  grid.jndi = rec.parentNode.parentNode.data.jndi; \
if(upperTableName.indexOf('.')>0)\
 upperTableName= upperTableName.split(\".\")[1];\
  Wb.setTitle(grid, tableName);\
  grid.store.load({\
    params: {\
      schemTableName: rec.data.text,\
      jndi: rec.parentNode.parentNode.data.jndi,\
      TABLE_NAME: upperTableName\
    }\
  });\
}",
       "afterrender": "Wb.setNavigate(tree, app.backBtn, app.forwardBtn);"
      }
     },
     {
      "configs": {
       "itemId": "grid1",
       "disabled": "true",
       "region": "center",
       "title": "字段字典定义",
       "iconCls": "book_icon",
       "multiSelect": "true"
      },
      "expanded": true,
      "children": [
       {
        "configs": {
         "itemId": "tbar",
         "enableOverflow": "true",
         "region": "north"
        },
        "expanded": true,
        "children": [
         {
          "configs": {
           "itemId": "newBtn",
           "tooltip": "添加新的记录 (Ctrl+E)",
           "text": "添加",
           "iconCls": "record_add_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "var win, tableName = app.grid1.tableName;\
if(app.grid1.tableName.indexOf('.')>0)\
 tableName= app.grid1.tableName.split(\".\")[1];\
\
app.editWin.setTitle('添加 -'+tableName);\
app.editWin.setIconCls('record_add_icon');\
app.editWin.show();\
app.isEdit = false; //标识是否为添加或修改状态，在editWin的ok事件中用到此属性\
app.TABLE_NAME.setValue(tableName);\
app.FIELD_NAME.store.load({\
params:{TABLE_NAME:tableName}});"}
         },
         {
          "configs": {
           "itemId": "editBtn",
           "tooltip": "修改选择的记录",
           "text": "修改",
           "iconCls": "record_edit_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "var  tableName = app.grid1.tableName;\
if(app.grid1.tableName.indexOf('.')>0)\
 tableName= app.grid1.tableName.split(\".\")[1];\
\
\
var sels = app.grid1.getSelection();\
if (sels.length != 1) {\
  Wb.warn('请选择 1 条需要修改的记录。');\
  return;\
}\
app.selRec = sels[0];\
app.editWin.setTitle('修改 - ' + app.selRec.data.FIELD_NAME);\
app.editWin.setIconCls('record_edit_icon');\
Wb.setValue(app.editWin, app.selRec.data);\
app.editWin.show();\
app.isEdit = true; //标识是否为添加或修改状态，在editWin的ok事件中用到此属性"}
         },
         {
          "configs": {
           "itemId": "delBtn",
           "tooltip": "删除选择的记录",
           "text": "删除",
           "iconCls": "record_delete_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "Wb.del(app.grid1, {\
  url: 'm?xwl=dev/dict/delete',\
  titleField: 'FIELD_NAME'\
});"}
         },
         {
          "configs": {
           "itemId": "item1",
           "text": "-"
          },
          "expanded": false,
          "children": [],
          "type": "item"
         },
         {
          "configs": {
           "itemId": "backBtn",
           "tooltip": "转到上一个页面",
           "text": "返回",
           "iconCls": "left_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item"
         },
         {
          "configs": {
           "itemId": "forwardBtn",
           "tooltip": "转到后退前的页面",
           "text": "前进",
           "iconCls": "right_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item"
         },
         {
          "configs": {
           "itemId": "forwardBtn1",
           "tooltip": "转到后退前的页面",
           "text": "生成",
           "iconCls": "go_icon"
          },
          "expanded": false,
          "children": [],
          "type": "item",
          "events": {"click": "Wb.request({\
  url: 'm?xwl=dev/wbTableEdit/proXwl',\
  params:{ TABLE_NAME: app.grid1.tableName,jndi: app.grid1.jndi} ,\
  success: function(resp) {\
  Wb.info(\"成功！\");}\
});"}
         }
        ],
        "type": "toolbar"
       },
       {
        "configs": {
         "itemId": "store",
         "sorters": "'FIELD_NAME'",
         "url": "m?xwl=dev/wbTableEdit/selectTable"
        },
        "expanded": false,
        "children": [],
        "type": "store",
        "events": {"success": "var col, grid = app.grid1;\
//重定义FIELD_NAME编辑器，允许输入自定义字段名称，用于Wb.edit函数\
app.fieldNameList = Wb.getTag(grid, 'tableFields');\
if (!grid.colsLoaded) {\
  col = Wb.getColumn(grid, 'FIELD_NAME');\
  col.editor = {\
    xtype: 'combo',\
    allowBlank: false,\
    queryMode: 'local',\
    displayField: 'name',\
    fieldStyle: 'text-transform:uppercase', //强制大写，避免不同数据库之间的差异\
    getValue: function() { //重载getValue使其取值大写\
      var val = Ext.form.field.ComboBox.prototype.getValue.apply(this);\
      return val ? val.toUpperCase() : val;\
    },\
    store: {\
      fields: ['name']\
    }\
  };\
  col = Wb.getColumn(grid, 'KEY_NAME');\
  col.editor = {\
    xtype: 'combo',\
    // forceSelection: true,\
    store: Wb.decode(\"{#keyNameList#}\")\
  };\
  grid.colsLoaded = true;\
}"}
       }
      ],
      "type": "grid",
      "events": {"itemdblclick": "app.editBtn.fireEvent('click');"}
     }
    ],
    "type": "viewport"
   }
  ],
  "type": "module",
  "events": {"initialize": "var  opeType;"}
 }],
 "roles": {},
 "title": "代码生成",
 "iconCls": "tool_icon",
 "inframe": true,
 "pageLink": ""
}