dialogImport.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $form;
  4. return {
  5. xtype: 'dialog',
  6. dialogId: 'dialogImport',
  7. title: 'Excel导入信息',
  8. width: 650,
  9. height: 350,
  10. onOpen: function () {
  11. loadingMask: false,
  12. $dlg = $(this);
  13. if (context.isEdit) {
  14. $.yvan.ajax({
  15. type: 'GET',
  16. url: api('/sys/sysImport/getById'),
  17. data: {
  18. importId: context.importId
  19. },
  20. success: function (data) {
  21. $dlg.find('form');
  22. $form.formSet(data.data);
  23. }
  24. });
  25. } else {
  26. // 点击新增按钮时操作:
  27. /*$(this).up('power').down('formgroup').formSet({
  28. // bcuId: context.bcuId,
  29. userId: context.userId,
  30. userName: context.userName
  31. });*/
  32. }
  33. },
  34. center: {
  35. items: {
  36. xtype: 'formgroup',
  37. subLabelWidth: '100',
  38. subControlWidth: '200',
  39. onRender: function () {
  40. $form = $(this);
  41. },
  42. items: [[
  43. {name: 'id', xtype: 'hidden'},
  44. {
  45. label: '表名',
  46. name: 'tbName',
  47. ff: 500,
  48. xtype: 'yvselect',
  49. required: true,
  50. data: $.yvan.sysDict('tbName').combo()
  51. },// 需要在字典管理菜单设置值
  52. {label: '启用状态', name: 'status', xtype: 'hidden', value: 0}// 通过value赋值提供下拉框默认值
  53. ]]
  54. }
  55. },
  56. buttons: [
  57. {
  58. text: "提交", iconCls: "fa fa-save", onClick: function () {
  59. $.yvan.postForm($form, {
  60. url: (context.isEdit ? api('/sys/sysImport/updateCaoGao') : api('/sys/sysImport/insert')),
  61. success: function () {
  62. $.yvan.msg('操作成功');
  63. $dlg.window('close');
  64. if ($.type(context.confirm) === 'function') {
  65. context.confirm();
  66. }
  67. }
  68. });
  69. }
  70. }, {
  71. text: "关闭", iconCls: "fa fa-times", onClick: function () {
  72. $dlg.dialog('close');
  73. }
  74. }
  75. ]
  76. };
  77. };
  78. });