InitStep.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. Ext.define('erp.view.common.init.InitStep', {
  2. extend: 'Ext.Viewport',
  3. style: 'background: #f1f2f5;',
  4. initComponent : function(){
  5. var me = this;
  6. Ext.apply(me, {
  7. items: [{
  8. xtype: 'panel',
  9. bodyStyle: 'background: #f1f2f5;',
  10. width: '100%',
  11. layout: {
  12. type: 'hbox',
  13. pack: 'center'
  14. },
  15. items: [ this.createStaticGrid(), this.createDynamicGrid() ],
  16. buttonAlign: 'center',
  17. buttons: [{
  18. text: '上一步',
  19. cls: 'custom-button',
  20. name: 'prev'
  21. }, {
  22. text: '刷新',
  23. name: 'refresh',
  24. cls: 'custom-button'
  25. }, {
  26. text: '下一步',
  27. name: 'next',
  28. cls: 'custom-button'
  29. }]
  30. }]
  31. });
  32. me.callParent(arguments);
  33. },
  34. createStaticGrid: function() {
  35. var me = this;
  36. Ext.define('Import', {
  37. extend : 'Ext.data.Model',
  38. fields : [ {
  39. name : 'no',
  40. type : 'number'
  41. }, {
  42. name : 'caller',
  43. type : 'string'
  44. }, {
  45. name : 'table',
  46. type : 'string'
  47. }, {
  48. name : 'cond',
  49. type : 'string'
  50. }, {
  51. name : 'module',
  52. type : 'string'
  53. }, {
  54. name : 'data',
  55. type : 'string'
  56. }, {
  57. name : 'count',
  58. type : 'string'
  59. }, {
  60. name : 'method',
  61. type : 'string'
  62. }]
  63. });
  64. var store = Ext.create('Ext.data.Store', {
  65. model : 'Import',
  66. sorters: [{
  67. property : 'no',
  68. direction: 'ASC'
  69. }],
  70. data: this._data
  71. });
  72. this.staticgrid = Ext.create('Ext.grid.Panel', {
  73. title: '静态数据',
  74. bodyStyle: 'background: #f1f1f1;min-height: 450px;',
  75. cls: 'custom',
  76. columns: [{
  77. text: '顺序',
  78. dataIndex: 'no',
  79. width: 40,
  80. tdCls: 'x-grid-cell-special',
  81. align: 'center'
  82. }, {
  83. text: '模块',
  84. dataIndex: 'module',
  85. width: 80
  86. }, {
  87. text: '数据',
  88. dataIndex: 'data',
  89. width: 140
  90. }, {
  91. text: '引入方式',
  92. dataIndex: 'method',
  93. width: 100
  94. }, {
  95. text: '已记录数',
  96. dataIndex: 'count',
  97. align: 'right',
  98. width: 70,
  99. renderer: function(val, meta, record) {
  100. if(val == 'loading') {
  101. meta.tdCls = 'loading';
  102. return '';
  103. }
  104. meta.tdCls = '';
  105. return val;
  106. }
  107. },{
  108. text: '导入',
  109. width: 50,
  110. cls: 'x-grid-header',
  111. renderer: function(val, meta){
  112. meta.tdCls = 'x-form-excel-trigger';
  113. meta.style = 'cursor:pointer;';
  114. return val;
  115. },
  116. processEvent: function(type, view, cell, recordIndex, cellIndex, e) {
  117. if (type == 'mousedown' || (type == 'keydown' && (e.getKey() == e.ENTER || e.getKey() == e.SPACE))) {
  118. var grid = view.ownerCt, record = grid.store.getAt(recordIndex);
  119. me.createTemplate(record);
  120. }
  121. return false;
  122. }
  123. }],
  124. columnLines: true,
  125. store: store
  126. });
  127. return this.staticgrid;
  128. },
  129. createDynamicGrid: function() {
  130. var me = this;
  131. Ext.define('Import', {
  132. extend : 'Ext.data.Model',
  133. fields : [ {
  134. name : 'no',
  135. type : 'number'
  136. }, {
  137. name : 'caller',
  138. type : 'string'
  139. }, {
  140. name : 'table',
  141. type : 'string'
  142. }, {
  143. name : 'cond',
  144. type : 'string'
  145. }, {
  146. name : 'module',
  147. type : 'string'
  148. }, {
  149. name : 'data',
  150. type : 'string'
  151. }, {
  152. name : 'count',
  153. type : 'string'
  154. }, {
  155. name : 'method',
  156. type : 'string'
  157. }]
  158. });
  159. var store = Ext.create('Ext.data.Store', {
  160. model : 'Import',
  161. sorters: [{
  162. property : 'no',
  163. direction: 'ASC'
  164. }],
  165. data: this.__data
  166. });
  167. this.dynamicgrid = Ext.create('Ext.grid.Panel', {
  168. title: '动态数据',
  169. bodyStyle: 'background: #f1f1f1;min-height: 450px;',
  170. cls: 'custom',
  171. name: 'dynamic',
  172. columns: [{
  173. text: '顺序',
  174. dataIndex: 'no',
  175. width: 40,
  176. tdCls: 'x-grid-cell-special',
  177. align: 'center'
  178. }, {
  179. text: '模块',
  180. dataIndex: 'module',
  181. width: 80
  182. }, {
  183. text: '数据',
  184. dataIndex: 'data',
  185. width: 140
  186. }, {
  187. text: '引入方式',
  188. dataIndex: 'method',
  189. width: 100
  190. }, {
  191. text: '已记录数',
  192. dataIndex: 'count',
  193. align: 'right',
  194. width: 70,
  195. renderer: function(val, meta, record) {
  196. if(val == 'loading') {
  197. meta.tdCls = 'loading';
  198. return '';
  199. }
  200. meta.tdCls = '';
  201. return val;
  202. }
  203. },{
  204. text: '引入',
  205. width: 50,
  206. cls: 'x-grid-header',
  207. renderer: function(val, meta){
  208. meta.tdCls = 'x-form-excel-trigger';
  209. meta.style = 'cursor:pointer;';
  210. return val;
  211. },
  212. processEvent: function(type, view, cell, recordIndex, cellIndex, e) {
  213. if (type == 'mousedown' || (type == 'keydown' && (e.getKey() == e.ENTER || e.getKey() == e.SPACE))) {
  214. var grid = view.ownerCt, record = grid.store.getAt(recordIndex);
  215. me.createTemplate(record);
  216. }
  217. return false;
  218. }
  219. }],
  220. columnLines: true,
  221. store: store
  222. });
  223. return this.dynamicgrid;
  224. },
  225. createTemplate: function(record) {
  226. var c = record.get('caller');
  227. if(!c) return;
  228. Ext.create('Ext.Window', {
  229. title: record.get('data'),
  230. width: '80%',
  231. height: '100%',
  232. autoShow: true,
  233. items: [{
  234. width: '100%',
  235. height: '100%',
  236. html: '<iframe src="' + basePath + 'jsps/common/import.jsp?whoami=' + c + '" height="100%" width="100%">'
  237. }]
  238. });
  239. },
  240. _data: [{
  241. no: 1,
  242. type: '静态数据',
  243. module: '人力资源',
  244. data: '部门',
  245. caller: 'Department',
  246. table: 'Department',
  247. method: 'excel'
  248. },{
  249. no: 2,
  250. type: '静态数据',
  251. module: '人力资源',
  252. data: '组织',
  253. caller: 'HrOrg',
  254. table: 'HrOrg',
  255. method: 'excel'
  256. },{
  257. no: 3,
  258. type: '静态数据',
  259. module: '人力资源',
  260. data: '职位',
  261. caller: 'HrHeadShip',
  262. table: 'HrHeadShip',
  263. method: 'excel'
  264. },{
  265. no: 4,
  266. type: '静态数据',
  267. module: '人力资源',
  268. data: '岗位',
  269. caller: 'Job',
  270. table: 'Job',
  271. method: 'excel、标准库'
  272. },{
  273. no: 5,
  274. type: '静态数据',
  275. module: '人力资源',
  276. data: '人事资料',
  277. caller: 'Employee',
  278. table: 'Employee',
  279. method: 'excel'
  280. },{
  281. no: 6,
  282. type: '静态数据',
  283. module: '基础资料',
  284. data: '仓库',
  285. caller: 'WareHouse',
  286. table: 'WareHouse',
  287. method: 'excel'
  288. },{
  289. no: 7,
  290. type: '静态数据',
  291. module: '基础资料',
  292. data: '付款方式',
  293. caller: 'Payments!Purc',
  294. table: 'Payments',
  295. cond: 'nvl(pa_forpurchase,0)=1',
  296. method: 'excel'
  297. },{
  298. no: 8,
  299. type: '静态数据',
  300. module: '基础资料',
  301. data: '收款方式',
  302. caller: 'Payments!Sale',
  303. table: 'Payments',
  304. cond: 'nvl(pa_forsale,0)=1',
  305. method: 'excel'
  306. },{
  307. no: 9,
  308. type: '静态数据',
  309. module: '基础资料',
  310. data: '供应商',
  311. caller: 'Vendor',
  312. table: 'Vendor',
  313. method: 'excel'
  314. },{
  315. no: 10,
  316. type: '静态数据',
  317. module: '基础资料',
  318. data: '客户',
  319. caller: 'Customer',
  320. table: 'Customer',
  321. method: 'excel'
  322. },{
  323. no: 11,
  324. type: '静态数据',
  325. module: '基础资料',
  326. data: '物料编码',
  327. caller: 'ProductKind',
  328. table: 'ProductKind',
  329. method: 'excel'
  330. },{
  331. no: 12,
  332. type: '静态数据',
  333. module: '基础资料',
  334. data: '物料',
  335. caller: 'Product',
  336. table: 'Product',
  337. method: 'excel'
  338. },{
  339. no: 13,
  340. type: '静态数据',
  341. module: '基础资料',
  342. data: '科目',
  343. caller: 'Category!Base',
  344. table: 'Category',
  345. method: 'excel'
  346. },{
  347. no: 14,
  348. type: '静态数据',
  349. module: '采购管理',
  350. data: '采购价格',
  351. caller: 'PurchasePrice',
  352. table: 'PurchasePrice',
  353. method: 'excel'
  354. },{
  355. no: 15,
  356. type: '静态数据',
  357. module: '销售管理',
  358. data: '销售价格',
  359. caller: 'SalePrice',
  360. table: 'SalePrice',
  361. method: 'excel'
  362. },{
  363. no: 16,
  364. type: '静态数据',
  365. module: '生产管理',
  366. data: 'BOM',
  367. caller: 'BOM',
  368. table: 'BOM',
  369. method: 'excel'
  370. }],
  371. __data: [{
  372. no: 17,
  373. type: '动态数据',
  374. module: '采购管理',
  375. data: '未完成采购单',
  376. caller: 'Purchase',
  377. table: 'Purchase',
  378. method: 'excel'
  379. },{
  380. no: 18,
  381. type: '动态数据',
  382. module: '销售管理',
  383. data: '未完成订单',
  384. caller: 'Sale',
  385. table: 'Sale',
  386. method: 'excel'
  387. },{
  388. no: 19,
  389. type: '动态数据',
  390. module: '生产管理',
  391. data: '未完成工单',
  392. table: 'Make',
  393. cond: 'ma_tasktype=\'MAKE\'',
  394. method: 'excel'
  395. },{
  396. no: 20,
  397. type: '动态数据',
  398. module: '生产管理',
  399. data: '未完成委外工单',
  400. table: 'Make',
  401. cond: 'ma_tasktype=\'OS\'',
  402. method: 'excel'
  403. },{
  404. no: 21,
  405. type: '动态数据',
  406. module: '供应链',
  407. data: '初始库存',
  408. caller: 'ProdInOut',
  409. table: 'ProdInOut',
  410. cond: 'pi_class=\'库存初始化\'',
  411. method: 'excel'
  412. },{
  413. no: 22,
  414. type: '动态数据',
  415. module: '供应链',
  416. data: '初始暂估',
  417. caller: 'Estimate',
  418. table: 'Estimate',
  419. method: 'excel'
  420. },{
  421. no: 23,
  422. type: '动态数据',
  423. module: '供应链',
  424. data: '初始发出商品',
  425. caller: 'GoodsSend',
  426. table: 'GoodsSend',
  427. method: 'excel'
  428. },{
  429. no: 24,
  430. type: '动态数据',
  431. module: '总账',
  432. data: '科目余额',
  433. caller: 'LedgerInit',
  434. table: 'LedgerInit',
  435. method: 'excel'
  436. },{
  437. no: 25,
  438. type: '动态数据',
  439. module: '总账',
  440. data: '辅助核算余额',
  441. caller: 'LedgerInitDetail',
  442. table: 'LedgerInitDetail',
  443. method: 'excel'
  444. },{
  445. no: 26,
  446. type: '动态数据',
  447. module: '应收款',
  448. data: '应收发票',
  449. caller: 'ARBill',
  450. table: 'ARBill',
  451. cond: 'ab_class=\'初始化\'',
  452. method: 'excel'
  453. },{
  454. no: 27,
  455. type: '动态数据',
  456. module: '应收款',
  457. data: '预收',
  458. caller: 'PreRec',
  459. table: 'PreRec',
  460. cond: 'pr_kind=\'初始化\'',
  461. method: 'excel'
  462. },{
  463. no: 28,
  464. type: '动态数据',
  465. module: '应付款',
  466. data: '应付发票',
  467. caller: 'APBill',
  468. table: 'APBill',
  469. cond: 'ab_class=\'初始化\'',
  470. method: 'excel'
  471. },{
  472. no: 29,
  473. type: '动态数据',
  474. module: '应付款',
  475. data: '预付',
  476. caller: 'PrePay',
  477. table: 'PrePay',
  478. cond: 'pp_type=\'初始化\'',
  479. method: 'excel'
  480. },{
  481. no: 30,
  482. type: '动态数据',
  483. module: '固定资产',
  484. caller: 'AssetsCard',
  485. data: '初始固定资产卡片',
  486. table: 'AssetsCard',
  487. method: 'excel'
  488. }]
  489. });