FormPanel.js 15 KB

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