FormPanel.js 15 KB

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