FormPanel.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. Ext.define('saas.view.sys.guide.FormPanel', {
  2. extend: 'Ext.panel.Panel',
  3. xtype: 'sys-guide-formpanel',
  4. layout:'fit',
  5. bodyCls:'x-guide-background',
  6. //工具类
  7. FormUtil: Ext.create('saas.util.FormUtil'),
  8. BaseUtil: Ext.create('saas.util.BaseUtil'),
  9. dataUrl:'/api/commons/init/check',
  10. initComponent: function () {
  11. var me = this;
  12. showInformation = function(type,value) {
  13. me.showInformation(type,value)
  14. }
  15. var view = new Ext.DataView({
  16. style:"margin:7% 0 7% 0;",
  17. store : Ext.create('Ext.data.Store', {
  18. fields: [{
  19. name:'baseSet',type:'boolean'
  20. },{
  21. name:'warehouse',type:'boolean'
  22. },{
  23. name:'product',type:'boolean'
  24. },{
  25. name:'customer',type:'boolean'
  26. },{
  27. name:'vendor',type:'boolean'
  28. },{
  29. name:'begin',type:'boolean'
  30. }],
  31. autoLoad: false,
  32. pageSize: 10,
  33. data: [{
  34. baseSet:false,
  35. warehouse:false,
  36. product:false,
  37. customer:false,
  38. vendor:false,
  39. begin:false,
  40. }],
  41. proxy: {
  42. timeout:8000,
  43. type: 'ajax',
  44. url: me.dataUrl,
  45. actionMethods: {
  46. read: 'GET'
  47. },
  48. reader: {
  49. type: 'json',
  50. rootProperty: 'data',
  51. totalProperty: 'data',
  52. }
  53. },
  54. }),
  55. tpl : new Ext.XTemplate(
  56. '<tpl for=".">',
  57. '<div class="x-guide-panel" align ="center">',
  58. '<div class="x-guide-item" align ="center" >',
  59. '<img class="',
  60. '<tpl if="!baseSet">x-guide-mask </tpl>',
  61. '" src="resources/images/guide/baseSet.png" style="margin:0 185px 0 0;" align ="center" width="135" height="90" alt="基础设置" onClick="showInformation(\'baseSet\')" >',
  62. '<img class="',
  63. '<tpl if="!warehouse">x-guide-mask </tpl>',
  64. '"src="resources/images/guide/warehouse.png" style="margin:0 185px 0 0;" align ="center" width="135" height="90" alt="仓库资料" onClick="showInformation(\'warehouse\')" >',
  65. '<img class="',
  66. '<tpl if="!product">x-guide-mask </tpl>',
  67. '"src="resources/images/guide/product.png" align ="center" width="135" height="90" alt="物料资料" onClick="showInformation(\'product\')" >',
  68. '</div>',
  69. '<div class="x-guide-item" align ="center">',
  70. '<img class="',
  71. '<tpl if="!baseSet">x-guide-mask </tpl>',
  72. '"src="resources/images/guide/1.png" style="margin: -20px 290px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'baseSet\')" >',
  73. '<img class="',
  74. '<tpl if="!warehouse">x-guide-mask </tpl>',
  75. '"src="resources/images/guide/2.png" style="margin: -20px 290px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'warehouse\')" >',
  76. '<img class="',
  77. '<tpl if="!product">x-guide-mask </tpl>',
  78. '"src="resources/images/guide/3.png" style="margin: -20px 0px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'product\')" >',
  79. '</div>',
  80. '<div class="x-guide-item" align ="center">',
  81. '<span style="margin:0 270px 0px 0;" align ="center" onClick="showInformation(\'baseSet\')" >基础设置</span>',
  82. '<span style="margin:0 270px 0px 0;" align ="center" onClick="showInformation(\'warehouse\')" >仓库资料</span>',
  83. '<span style="margin:0 0px 0px 0;" align ="center" onClick="showInformation(\'product\')" >物料资料</span>',
  84. '</div>',
  85. '<div class="x-guide-item" align ="center">',
  86. '<img class="',
  87. '<tpl if="!baseSet">x-guide-mask </tpl>',
  88. '"src="resources/images/guide/point.png" style="margin: 2px 306px 0 0;" align ="center" width="16" height="16" >',
  89. '<img class="',
  90. '<tpl if="!warehouse">x-guide-mask </tpl>',
  91. '"src="resources/images/guide/point.png" style="margin: 2px 306px 0 0;" align ="center" width="16" height="16" >',
  92. '<img class="',
  93. '<tpl if="!product">x-guide-mask </tpl>',
  94. '"src="resources/images/guide/point.png" style="margin: 2px 0px 0 0;" align ="center" width="16" height="16" >',
  95. "<br>",
  96. '<div class="x-guide-line" height="1" style="border:1px solid #E4F7FF;margin: -9px 0 0 0;width: 654px !important;" align ="center"></div>',
  97. '</div>',
  98. '<div class="x-guide-item" align ="center">',
  99. '<img class="',
  100. '<tpl if="!customer">x-guide-mask </tpl>',
  101. '"src="resources/images/guide/customer.png" style="margin:50px 185px 0 0;" align ="center" width="135" height="90" alt="客户资料" onClick="showInformation(\'customer\')" >',
  102. '<img class="',
  103. '<tpl if="!vendor">x-guide-mask </tpl>',
  104. '"src="resources/images/guide/vendor.png" style="margin:50px 185px 0 0;" align ="center" width="135" height="90" alt="供应商资料" onClick="showInformation(\'vendor\')" >',
  105. '<img class="',
  106. '<tpl if="!begin">x-guide-mask </tpl>',
  107. '" src="resources/images/guide/begin.png" style="margin:50px 0 0 0;" align ="center" width="135" height="90" alt="开始使用" onClick="showInformation(\'begin\',\'{begin}\')" >',
  108. '</div>',
  109. '<div class="x-guide-item" align ="center">',
  110. '<img class="',
  111. '<tpl if="!customer">x-guide-mask </tpl>',
  112. '" src="resources/images/guide/4.png" style="margin: -20px 290px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'customer\')" >',
  113. '<img class="',
  114. '<tpl if="!vendor">x-guide-mask </tpl>',
  115. '" src="resources/images/guide/5.png" style="margin: -20px 290px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'vendor\')">',
  116. '<img class="',
  117. '<tpl if="!begin">x-guide-mask </tpl>',
  118. '" src="resources/images/guide/6.png" style="margin: -20px 0px 0 0;" align ="center" width="32" height="32" onClick="showInformation(\'begin\',\'{begin}\')" >',
  119. '</div>',
  120. '<div class="x-guide-item" align ="center">',
  121. '<span style="margin:0 265px 100px 0;" align ="center" onClick="showInformation(\'customer\')" >客户资料</span>',
  122. '<span style="margin:0 265px 100px 0;" align ="center" onClick="showInformation(\'vendor\')" >供应商资料</span>',
  123. '<span style="margin:0 0px 100px 0;" align ="center" onClick="showInformation(\'begin\',\'{begin}\')" >开始使用</span>',
  124. '</div>',
  125. '<div class="x-guide-item" align ="center">',
  126. '<img class="',
  127. '<tpl if="!customer">x-guide-mask </tpl>',
  128. '" src="resources/images/guide/point.png" style="margin: 2px 306px 0 0;" align ="center" width="16" height="16" >',
  129. '<img class="',
  130. '<tpl if="!vendor">x-guide-mask </tpl>',
  131. '" src="resources/images/guide/point.png" style="margin: 2px 306px 0 0;" align ="center" width="16" height="16" >',
  132. '<img class="',
  133. '<tpl if="!begin">x-guide-mask </tpl>',
  134. '" src="resources/images/guide/point.png" style="margin: 2px 0px 0 0;" align ="center" width="16" height="16" >',
  135. "<br>",
  136. '<div class="x-guide-line" height="1" style="border:1px solid #E4F7FF;margin: -9px 0 0 0;width: 654px !important;" align ="center"></div>',
  137. '</div>',
  138. '</div>',
  139. '</tpl>'
  140. ),
  141. trackOver: true,
  142. overItemCls : 'x-module-over',
  143. selectedClass : 'selected',
  144. singleSelect : true,
  145. itemSelector : '.x-module-item'
  146. });
  147. Ext.apply(me,{
  148. items:[view]
  149. });
  150. me.view = view;
  151. me.callParent(arguments);
  152. },
  153. refresh:function(){
  154. this.ownerCt.setTitle('新手导航');
  155. //刷新store数据
  156. this.view.store.load();
  157. //刷新窗口
  158. var win = this.down('[name=messagebox]');
  159. if(win){
  160. win.show({
  161. title : '模块介绍',
  162. msg : win.msg.html,
  163. icon : win._icon
  164. });
  165. }
  166. },
  167. showInformation:function(type,value){
  168. var message = '';
  169. var xtype = '';
  170. var icon = 'x-gudie-information';
  171. var title = '';
  172. if(type=='baseSet'){
  173. message = '<span>您可以在参数设置中编辑公司的信息。</br>'+
  174. '录入完成后切换到“新手导航”页签继续下一步。</span>';
  175. xtype = 'sys-manager-formpanel';
  176. }
  177. if(type=='warehouse'){
  178. message = '<span>因为新增物料时需要告知该物料所属仓库是哪里,所以需要首先进行仓库管理。</br>'+
  179. '录入完成后切换到“新手导航”页签继续下一步。</span>';
  180. xtype = 'other-warehouse';
  181. title = '仓库资料'
  182. }
  183. if(type=='product'){
  184. message = '<span>录入物料及其期初数量;开账后也可通过录采购单对物料库存进行增加,</br>录销售单物料库存相应减少。</br>'+
  185. '录入完成后切换到“新手导航”页签继续下一步。</span>';
  186. xtype = 'document-product-basepanel';
  187. title = '物料资料'
  188. }
  189. if(type=='customer'){
  190. message = '<span>对客户资料进行录入及管理。</br>'+
  191. '录入完成后切换到“新手导航”页签继续下一步。</span>';
  192. xtype = 'document-customer-basepanel';
  193. title = '客户资料'
  194. }
  195. if(type=='vendor'){
  196. message = '<span>录采购单时需选择供应商,在单据页面选择供应商时</br>也提供供应商新增功能,您也可以跳过此步。</br>'+
  197. '录入完成后切换到“新手导航”页签继续下一步。</span>';
  198. xtype = 'document-vendor-basepanel';
  199. title = '供应商资料'
  200. }
  201. if(type=='begin'){
  202. message = '<span>欢迎您使用优企云进销存!</br>'+
  203. '温馨提示:开账后您还是可以通过左侧菜单栏对基础资料进行维护。</span>';
  204. xtype = "begin";
  205. icon = 'x-gudie-end';
  206. if(value=='false'){
  207. icon = 'x-gudie-information';
  208. message = '<h4>请激活所有模块后再使用系统!</h4>';
  209. }
  210. }
  211. var me = this;
  212. var form = this.view.ownerCt;
  213. var panelEl = form.getEl()
  214. var box = panelEl.getBox();
  215. var height = box.height;
  216. var width = box.width;
  217. var win = form.add(Ext.create('Ext.window.MessageBox', {
  218. name:'messagebox',
  219. closeAction:'destroy',
  220. _icon:icon,
  221. msg:message,
  222. buttonAlign : 'right',
  223. height:0.5*height,
  224. width:0.5*width,
  225. buttons: [{
  226. text: '我知道了',
  227. cls:'x-formpanel-btn-orange',
  228. handler: function(b) {
  229. var scope = b.ownerCt.ownerCt;
  230. if(xtype=='begin'&&value=='false'){
  231. scope.close();
  232. return true;
  233. }else if(xtype=='begin'&&value=='true'){
  234. me.ownerCt.close();
  235. return true;
  236. }
  237. saas.util.BaseUtil.openTab(xtype, title, xtype+'_add');
  238. scope.close();
  239. }
  240. },{
  241. text: '取消',
  242. cls:'x-formpanel-btn-blue',
  243. handler: function(b) {
  244. var scope = b.ownerCt.ownerCt;
  245. scope.close();
  246. }
  247. }]
  248. }));
  249. win.show({
  250. title : '模块介绍',
  251. msg : message,
  252. icon : icon
  253. });
  254. }
  255. });