ViewportModel.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. Ext.define('school.view.viewport.ViewportModel', {
  2. extend: 'Ext.app.ViewModel',
  3. alias: 'viewmodel.viewport',
  4. data: {
  5. account: null
  6. },
  7. formulas: {
  8. company: function (get) {
  9. var account = get('account');
  10. return account && account.companies.find(function (c) {
  11. return c.id == account.companyId;
  12. });
  13. },
  14. avatarUrl: function (get) {
  15. var account = get('account');
  16. return (account && account.avatarUrl) || 'resources/images/default/user-icon.png'
  17. }
  18. },
  19. stores: {
  20. grade: {
  21. type: 'tree',
  22. // model: 'school.model.Grade',
  23. fields: [{
  24. name: 'text'
  25. }],
  26. root: {
  27. text: '全年级',
  28. type: 'school',
  29. expanded: true
  30. },
  31. data: [{
  32. id: 'g1',
  33. text: '一年级',
  34. // grade_id: '1',
  35. // grade_name: '一年级',
  36. // grade_status: '1',
  37. // grade_remarks: 'beizhu',
  38. // grade_adress: '值dadada dad',
  39. // school_id: '1',
  40. type: 'grade',
  41. children: [{
  42. id: 'c11',
  43. text: '一年级1班',
  44. type: 'class',
  45. leaf: true
  46. }, {
  47. id: 'c12',
  48. text: '一年级2班',
  49. type: 'class',
  50. leaf: true
  51. }, {
  52. id: 'c13',
  53. text: '一年级3班',
  54. type: 'class',
  55. leaf: true
  56. }, {
  57. id: 'c14',
  58. text: '一年级4班',
  59. type: 'class',
  60. leaf: true
  61. }, {
  62. id: 'c15',
  63. text: '一年级5班',
  64. type: 'class',
  65. leaf: true
  66. }]
  67. }, {
  68. id: 'g2',
  69. text: '二年级',
  70. type: 'grade',
  71. children: [{
  72. id: 'c21',
  73. text: '二年级1班',
  74. type: 'class',
  75. leaf: true
  76. }, {
  77. id: 'c22',
  78. text: '二年级2班',
  79. type: 'class',
  80. leaf: true
  81. }, {
  82. id: 'c23',
  83. text: '二年级3班',
  84. type: 'class',
  85. leaf: true
  86. }, {
  87. id: 'c24',
  88. text: '二年级4班',
  89. type: 'class',
  90. leaf: true
  91. }]
  92. }, {
  93. id: 'g3',
  94. text: '三年级',
  95. type: 'grade',
  96. children: [{
  97. id: 'c31',
  98. text: '三年级1班',
  99. type: 'class',
  100. leaf: true
  101. }, {
  102. id: 'c32',
  103. text: '三年级2班',
  104. type: 'class',
  105. leaf: true
  106. }, {
  107. id: 'c33',
  108. text: '三年级3班',
  109. type: 'class',
  110. leaf: true
  111. }, {
  112. id: 'c34',
  113. text: '三年级4班',
  114. type: 'class',
  115. leaf: true
  116. }, {
  117. id: 'c35',
  118. text: '三年级5班',
  119. type: 'class',
  120. leaf: true
  121. }, {
  122. id: 'c36',
  123. text: '三年级6班',
  124. type: 'class',
  125. leaf: true
  126. }]
  127. }, {
  128. id: 'g4',
  129. text: '四年级',
  130. type: 'grade',
  131. children: [{
  132. id: 'c41',
  133. text: '四年级1班',
  134. type: 'class',
  135. leaf: true
  136. }, {
  137. id: 'c42',
  138. text: '四年级2班',
  139. type: 'class',
  140. leaf: true
  141. }, {
  142. id: 'c43',
  143. text: '四年级3班',
  144. type: 'class',
  145. leaf: true
  146. }, {
  147. id: 'c44',
  148. text: '四年级4班',
  149. type: 'class',
  150. leaf: true
  151. }, {
  152. id: 'c45',
  153. text: '四年级5班',
  154. type: 'class',
  155. leaf: true
  156. }, {
  157. id: 'c46',
  158. text: '四年级6班',
  159. type: 'class',
  160. leaf: true
  161. }]
  162. }, {
  163. id: 'g5',
  164. text: '五年级',
  165. type: 'grade',
  166. children: [{
  167. id: 'c51',
  168. text: '五年级1班',
  169. type: 'class',
  170. leaf: true
  171. }, {
  172. id: 'c52',
  173. text: '五年级2班',
  174. type: 'class',
  175. leaf: true
  176. }, {
  177. id: 'c53',
  178. text: '五年级3班',
  179. type: 'class',
  180. leaf: true
  181. }, {
  182. id: 'c54',
  183. text: '五年级4班',
  184. type: 'class',
  185. leaf: true
  186. }, {
  187. id: 'c55',
  188. text: '五年级5班',
  189. type: 'class',
  190. leaf: true
  191. }, {
  192. id: 'c56',
  193. text: '五年级6班',
  194. type: 'class',
  195. leaf: true
  196. }]
  197. }, {
  198. id: 'g6',
  199. text: '六年级',
  200. type: 'grade',
  201. children: [{
  202. id: 'c61',
  203. text: '六年级1班',
  204. type: 'class',
  205. leaf: true
  206. }, {
  207. id: 'c62',
  208. text: '六年级2班',
  209. type: 'class',
  210. leaf: true
  211. }, {
  212. id: 'c63',
  213. text: '六年级3班',
  214. type: 'class',
  215. leaf: true
  216. }, {
  217. id: 'c64',
  218. text: '六年级4班',
  219. type: 'class',
  220. leaf: true
  221. }, {
  222. id: 'c65',
  223. text: '六年级5班',
  224. type: 'class',
  225. leaf: true
  226. }, {
  227. id: 'c66',
  228. text: '六年级6班',
  229. type: 'class',
  230. leaf: true
  231. }, {
  232. id: 'c6y1',
  233. text: '六年级扬帆班',
  234. type: 'class',
  235. leaf: true
  236. }]
  237. }, {
  238. id: 'gn',
  239. text: '新的年级',
  240. type: 'grade',
  241. children: []
  242. }]
  243. }
  244. }
  245. });