mm_os 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.en.md +36 -0
  2. package/README.md +25 -166
  3. package/conf.json +3 -0
  4. package/core/base/index.js +29 -0
  5. package/core/base/mqtt/index.js +268 -0
  6. package/core/base/mqtt/lib.js +40 -0
  7. package/core/base/web/index.js +110 -0
  8. package/core/com/api/com.json +4 -0
  9. package/{bin → core}/com/api/config.tpl.json +9 -7
  10. package/{bin → core}/com/api/drive.js +239 -64
  11. package/{bin → core}/com/api/index.js +8 -9
  12. package/{bin → core}/com/api/oauth.js +23 -14
  13. package/core/com/api/script.js +32 -0
  14. package/core/com/db/com.json +4 -0
  15. package/{bin → core}/com/db/drive.js +99 -65
  16. package/{bin → core}/com/db/index.js +2 -2
  17. package/core/com/event/com.json +4 -0
  18. package/{bin → core}/com/event/config.tpl.json +2 -2
  19. package/core/com/event/drive.js +125 -0
  20. package/{bin → core}/com/event/index.js +5 -10
  21. package/core/com/event/script.js +26 -0
  22. package/core/com/eventer/com.js +450 -0
  23. package/core/com/eventer/com.json +4 -0
  24. package/core/com/middleware/com.js +128 -0
  25. package/core/com/middleware/com.json +4 -0
  26. package/core/com/middleware/config.tpl.json +8 -0
  27. package/core/com/middleware/script.js +9 -0
  28. package/core/com/mqtt/com.json +4 -0
  29. package/core/com/mqtt/config.tpl.json +12 -0
  30. package/core/com/mqtt/drive.js +139 -0
  31. package/core/com/mqtt/index.js +138 -0
  32. package/core/com/mqtt/script.js +33 -0
  33. package/core/com/msg/com.js +296 -0
  34. package/core/com/msg/com.json +4 -0
  35. package/{bin → core}/com/nav/drive.js +42 -17
  36. package/{bin → core}/com/nav/index.js +4 -4
  37. package/core/com/nav/tpl/admin_pc/page_channel.vue +299 -0
  38. package/core/com/nav/tpl/admin_pc/page_config.vue +279 -0
  39. package/core/com/nav/tpl/admin_pc/page_config_form.vue +194 -0
  40. package/core/com/nav/tpl/admin_pc/page_default.vue +287 -0
  41. package/core/com/nav/tpl/admin_pc/page_form.vue +180 -0
  42. package/core/com/nav/tpl/admin_pc/page_lang.vue +265 -0
  43. package/core/com/nav/tpl/admin_pc/page_nav.vue +313 -0
  44. package/core/com/nav/tpl/admin_pc/page_table.vue +285 -0
  45. package/core/com/nav/tpl/admin_pc/page_type.vue +313 -0
  46. package/core/com/nav/tpl/dev_pc/page_channel.vue +253 -0
  47. package/core/com/nav/tpl/dev_pc/page_config.vue +253 -0
  48. package/core/com/nav/tpl/dev_pc/page_default.vue +247 -0
  49. package/core/com/nav/tpl/dev_pc/page_form.vue +162 -0
  50. package/core/com/nav/tpl/dev_pc/page_nav.vue +253 -0
  51. package/core/com/nav/tpl/dev_pc/page_table.vue +247 -0
  52. package/core/com/nav/tpl/dev_pc/page_type.vue +253 -0
  53. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_channel.vue +231 -231
  54. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_default.vue +231 -231
  55. package/{bin → core}/com/nav/tpl/home_pc/page_form.vue +9 -9
  56. package/{bin → core}/com/nav/tpl/home_pc/page_list.vue +231 -231
  57. package/{bin → core}/com/nav/tpl/home_pc/page_nav.vue +221 -221
  58. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_type.vue +231 -231
  59. package/{bin → core}/com/nav/tpl/home_pc/page_view.vue +8 -8
  60. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_channel.vue +231 -231
  61. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_default.vue +231 -231
  62. package/{bin → core}/com/nav/tpl/home_phone/page_form.vue +9 -9
  63. package/{bin → core}/com/nav/tpl/home_phone/page_list.vue +231 -231
  64. package/{bin/com/nav/tpl/admin_pc → core/com/nav/tpl/home_phone}/page_nav.vue +236 -220
  65. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_type.vue +231 -231
  66. package/{bin → core}/com/nav/tpl/home_phone/page_view.vue +8 -8
  67. package/core/com/nav/viewmodel.js +296 -0
  68. package/{bin → core}/com/param/config.tpl.json +24 -0
  69. package/{bin → core}/com/param/drive.js +47 -15
  70. package/core/com/plugin/com.json +4 -0
  71. package/core/com/plugin/config.tpl.json +20 -0
  72. package/{bin → core}/com/plugin/drive.js +5 -8
  73. package/{bin → core}/com/plugin/index.js +11 -56
  74. package/core/com/socket/README.md +47 -0
  75. package/core/com/socket/com.json +4 -0
  76. package/core/com/socket/config.tpl.json +14 -0
  77. package/{bin → core}/com/socket/drive.js +74 -51
  78. package/{bin → core}/com/socket/index.js +4 -2
  79. package/{bin → core}/com/socket/script.js +8 -6
  80. package/core/com/sql/config.tpl.json +70 -0
  81. package/{bin → core}/com/sql/drive.js +281 -58
  82. package/core/com/static/com.json +4 -0
  83. package/core/com/static/config.tpl.json +20 -0
  84. package/{bin → core}/com/static/drive.js +6 -4
  85. package/{bin → core}/com/static/index.js +5 -1
  86. package/core/com/task/com.json +4 -0
  87. package/core/com/task/config.tpl.json +24 -0
  88. package/core/com/task/drive.js +374 -0
  89. package/{bin → core}/com/task/index.js +14 -20
  90. package/core/com/task/script.js +37 -0
  91. package/core/com/timer/com.js +217 -0
  92. package/core/com/timer/com.json +4 -0
  93. package/core/com/tpl/com.js +19 -0
  94. package/core/com/tpl/com.json +4 -0
  95. package/index.js +161 -740
  96. package/lib/actions.js +50 -0
  97. package/lib/app.js +73 -0
  98. package/lib/base.js +355 -0
  99. package/lib/com.js +31 -0
  100. package/lib/game.js +31 -0
  101. package/lib/ref.js +121 -0
  102. package/middleware/cors/index.js +57 -0
  103. package/middleware/cors/middleware.json +7 -0
  104. package/middleware/mqtt_base/index.js +10 -0
  105. package/middleware/mqtt_base/middleware.json +8 -0
  106. package/{waf.js → middleware/waf/index.js} +12 -2
  107. package/middleware/waf/middleware.json +9 -0
  108. package/middleware/web_base/index.js +67 -0
  109. package/middleware/web_base/middleware.json +9 -0
  110. package/middleware/web_event/index.js +411 -0
  111. package/middleware/web_event/middleware.json +10 -0
  112. package/middleware/web_proxy/index.js +24 -0
  113. package/middleware/web_proxy/middleware.json +9 -0
  114. package/middleware/web_router/index.js +33 -0
  115. package/middleware/web_router/middleware.json +10 -0
  116. package/middleware/web_socket/index.js +21 -0
  117. package/middleware/web_socket/middleware.json +9 -0
  118. package/middleware/web_static/index.js +26 -0
  119. package/middleware/web_static/middleware.json +9 -0
  120. package/nodemon.json +12 -2
  121. package/package.json +56 -66
  122. package/.gitattributes +0 -5
  123. package/bin/com/README.md +0 -2
  124. package/bin/com/api/script.js +0 -14
  125. package/bin/com/cmd/README.md +0 -3
  126. package/bin/com/cmd/config.tpl.json +0 -41
  127. package/bin/com/cmd/drive.js +0 -512
  128. package/bin/com/cmd/index.js +0 -213
  129. package/bin/com/cmd/old/5w2h.js +0 -54
  130. package/bin/com/cmd/old/drive.js +0 -423
  131. package/bin/com/cmd/script.js +0 -11
  132. package/bin/com/event/drive.js +0 -69
  133. package/bin/com/event/script.js +0 -12
  134. package/bin/com/nav/tpl/admin_pc/page_channel.vue +0 -234
  135. package/bin/com/nav/tpl/admin_pc/page_default.vue +0 -236
  136. package/bin/com/nav/tpl/admin_pc/page_form.vue +0 -152
  137. package/bin/com/nav/tpl/admin_pc/page_table.vue +0 -236
  138. package/bin/com/nav/tpl/admin_pc/page_type.vue +0 -234
  139. package/bin/com/nav/tpl/home_phone/page_nav.vue +0 -221
  140. package/bin/com/nav/viewmodel.js +0 -161
  141. package/bin/com/plugin/config.tpl.json +0 -11
  142. package/bin/com/socket/config.tpl.json +0 -8
  143. package/bin/com/sql/config.tpl.json +0 -34
  144. package/bin/com/static/config.tpl.json +0 -11
  145. package/bin/com/task/config.tpl.json +0 -13
  146. package/bin/com/task/drive.js +0 -288
  147. package/bin/com/task/script.js +0 -38
  148. package/bin/com.js +0 -74
  149. package/bin/mm.conf +0 -48
  150. package/bin/static/404.html +0 -52
  151. package/bin/static/README.md +0 -1
  152. package/bin/static/css/font-awesome.min.css +0 -7
  153. package/bin/static/css/mm_base.css +0 -220
  154. package/bin/static/css/mm_common.css +0 -518
  155. package/bin/static/css/mm_component.css +0 -307
  156. package/bin/static/css/mm_expand.css +0 -634
  157. package/bin/static/css/mm_theme.css +0 -291
  158. package/bin/static/css/new_file.css +0 -79
  159. package/bin/static/css/swiper.min.css +0 -12
  160. package/bin/static/favicon.ico +0 -0
  161. package/bin/static/font/FontAwesome.otf +0 -0
  162. package/bin/static/font/HelveticaNeue.eot +0 -0
  163. package/bin/static/font/HelveticaNeue.otf +0 -0
  164. package/bin/static/font/HelveticaNeue.svg +0 -1273
  165. package/bin/static/font/HelveticaNeue.woff +0 -0
  166. package/bin/static/font/HelveticaNeue.woff2 +0 -0
  167. package/bin/static/font/fontawesome-webfont.eot +0 -0
  168. package/bin/static/font/fontawesome-webfont.svg +0 -2671
  169. package/bin/static/font/fontawesome-webfont.ttf +0 -0
  170. package/bin/static/font/fontawesome-webfont.woff +0 -0
  171. package/bin/static/font/fontawesome-webfont.woff2 +0 -0
  172. package/bin/static/h5.html +0 -325
  173. package/bin/static/highlight/highlight.pack.js +0 -2
  174. package/bin/static/highlight/styles/a11y-dark.css +0 -99
  175. package/bin/static/highlight/styles/a11y-light.css +0 -99
  176. package/bin/static/highlight/styles/agate.css +0 -108
  177. package/bin/static/highlight/styles/an-old-hope.css +0 -89
  178. package/bin/static/highlight/styles/androidstudio.css +0 -66
  179. package/bin/static/highlight/styles/arduino-light.css +0 -88
  180. package/bin/static/highlight/styles/arta.css +0 -73
  181. package/bin/static/highlight/styles/ascetic.css +0 -45
  182. package/bin/static/highlight/styles/atelier-cave-dark.css +0 -83
  183. package/bin/static/highlight/styles/atelier-cave-light.css +0 -85
  184. package/bin/static/highlight/styles/atelier-dune-dark.css +0 -69
  185. package/bin/static/highlight/styles/atelier-dune-light.css +0 -69
  186. package/bin/static/highlight/styles/atelier-estuary-dark.css +0 -84
  187. package/bin/static/highlight/styles/atelier-estuary-light.css +0 -84
  188. package/bin/static/highlight/styles/atelier-forest-dark.css +0 -69
  189. package/bin/static/highlight/styles/atelier-forest-light.css +0 -69
  190. package/bin/static/highlight/styles/atelier-heath-dark.css +0 -69
  191. package/bin/static/highlight/styles/atelier-heath-light.css +0 -69
  192. package/bin/static/highlight/styles/atelier-lakeside-dark.css +0 -69
  193. package/bin/static/highlight/styles/atelier-lakeside-light.css +0 -69
  194. package/bin/static/highlight/styles/atelier-plateau-dark.css +0 -84
  195. package/bin/static/highlight/styles/atelier-plateau-light.css +0 -84
  196. package/bin/static/highlight/styles/atelier-savanna-dark.css +0 -84
  197. package/bin/static/highlight/styles/atelier-savanna-light.css +0 -84
  198. package/bin/static/highlight/styles/atelier-seaside-dark.css +0 -69
  199. package/bin/static/highlight/styles/atelier-seaside-light.css +0 -69
  200. package/bin/static/highlight/styles/atelier-sulphurpool-dark.css +0 -69
  201. package/bin/static/highlight/styles/atelier-sulphurpool-light.css +0 -69
  202. package/bin/static/highlight/styles/atom-one-dark-reasonable.css +0 -77
  203. package/bin/static/highlight/styles/atom-one-dark.css +0 -96
  204. package/bin/static/highlight/styles/atom-one-light.css +0 -96
  205. package/bin/static/highlight/styles/brown-paper.css +0 -64
  206. package/bin/static/highlight/styles/brown-papersq.png +0 -0
  207. package/bin/static/highlight/styles/codepen-embed.css +0 -60
  208. package/bin/static/highlight/styles/color-brewer.css +0 -71
  209. package/bin/static/highlight/styles/darcula.css +0 -77
  210. package/bin/static/highlight/styles/dark.css +0 -63
  211. package/bin/static/highlight/styles/darkula.css +0 -6
  212. package/bin/static/highlight/styles/default.css +0 -99
  213. package/bin/static/highlight/styles/docco.css +0 -97
  214. package/bin/static/highlight/styles/dracula.css +0 -76
  215. package/bin/static/highlight/styles/far.css +0 -71
  216. package/bin/static/highlight/styles/foundation.css +0 -88
  217. package/bin/static/highlight/styles/github-gist.css +0 -79
  218. package/bin/static/highlight/styles/github.css +0 -99
  219. package/bin/static/highlight/styles/gml.css +0 -78
  220. package/bin/static/highlight/styles/googlecode.css +0 -89
  221. package/bin/static/highlight/styles/grayscale.css +0 -101
  222. package/bin/static/highlight/styles/gruvbox-dark.css +0 -108
  223. package/bin/static/highlight/styles/gruvbox-light.css +0 -108
  224. package/bin/static/highlight/styles/hopscotch.css +0 -83
  225. package/bin/static/highlight/styles/hybrid.css +0 -102
  226. package/bin/static/highlight/styles/idea.css +0 -97
  227. package/bin/static/highlight/styles/ir-black.css +0 -73
  228. package/bin/static/highlight/styles/isbl-editor-dark.css +0 -112
  229. package/bin/static/highlight/styles/isbl-editor-light.css +0 -112
  230. package/bin/static/highlight/styles/kimbie.dark.css +0 -74
  231. package/bin/static/highlight/styles/kimbie.light.css +0 -74
  232. package/bin/static/highlight/styles/lightfair.css +0 -87
  233. package/bin/static/highlight/styles/magula.css +0 -70
  234. package/bin/static/highlight/styles/mono-blue.css +0 -59
  235. package/bin/static/highlight/styles/monokai-sublime.css +0 -83
  236. package/bin/static/highlight/styles/monokai.css +0 -70
  237. package/bin/static/highlight/styles/nord.css +0 -309
  238. package/bin/static/highlight/styles/obsidian.css +0 -88
  239. package/bin/static/highlight/styles/ocean.css +0 -74
  240. package/bin/static/highlight/styles/paraiso-dark.css +0 -72
  241. package/bin/static/highlight/styles/paraiso-light.css +0 -72
  242. package/bin/static/highlight/styles/pojoaque.css +0 -83
  243. package/bin/static/highlight/styles/pojoaque.jpg +0 -0
  244. package/bin/static/highlight/styles/purebasic.css +0 -96
  245. package/bin/static/highlight/styles/qtcreator_dark.css +0 -83
  246. package/bin/static/highlight/styles/qtcreator_light.css +0 -83
  247. package/bin/static/highlight/styles/railscasts.css +0 -106
  248. package/bin/static/highlight/styles/rainbow.css +0 -85
  249. package/bin/static/highlight/styles/routeros.css +0 -108
  250. package/bin/static/highlight/styles/school-book.css +0 -69
  251. package/bin/static/highlight/styles/school-book.png +0 -0
  252. package/bin/static/highlight/styles/shades-of-purple.css +0 -97
  253. package/bin/static/highlight/styles/solarized-dark.css +0 -84
  254. package/bin/static/highlight/styles/solarized-light.css +0 -84
  255. package/bin/static/highlight/styles/sunburst.css +0 -102
  256. package/bin/static/highlight/styles/tomorrow-night-blue.css +0 -75
  257. package/bin/static/highlight/styles/tomorrow-night-bright.css +0 -74
  258. package/bin/static/highlight/styles/tomorrow-night-eighties.css +0 -74
  259. package/bin/static/highlight/styles/tomorrow-night.css +0 -75
  260. package/bin/static/highlight/styles/tomorrow.css +0 -72
  261. package/bin/static/highlight/styles/vs.css +0 -68
  262. package/bin/static/highlight/styles/vs2015.css +0 -115
  263. package/bin/static/highlight/styles/xcode.css +0 -104
  264. package/bin/static/highlight/styles/xt256.css +0 -92
  265. package/bin/static/highlight/styles/zenburn.css +0 -80
  266. package/bin/static/highlight/vue-highlight.js +0 -29
  267. package/bin/static/ifame.html +0 -24
  268. package/bin/static/img/add.png +0 -0
  269. package/bin/static/img/avatar.png +0 -0
  270. package/bin/static/img/banner_2.png +0 -0
  271. package/bin/static/img/default.png +0 -0
  272. package/bin/static/img/loading.svg +0 -1
  273. package/bin/static/img/logo.png +0 -0
  274. package/bin/static/img/logo1.png +0 -0
  275. package/bin/static/img/logo_gray.png +0 -0
  276. package/bin/static/img/logo_round.png +0 -0
  277. package/bin/static/img/mm.ico +0 -0
  278. package/bin/static/img/mm.jpg +0 -0
  279. package/bin/static/img/select.png +0 -0
  280. package/bin/static/img/web.png +0 -0
  281. package/bin/static/index.html +0 -12
  282. package/bin/static/js/clipboard.min.js +0 -257
  283. package/bin/static/js/css.min.js +0 -1
  284. package/bin/static/js/echarts.js +0 -22
  285. package/bin/static/js/html5.min.js +0 -1
  286. package/bin/static/js/jquery.lazyload.min.js +0 -2
  287. package/bin/static/js/jquery.min.js +0 -4189
  288. package/bin/static/js/jquery.scrollstop.min.js +0 -2
  289. package/bin/static/js/mm-requirejs-vue.js +0 -283
  290. package/bin/static/js/mm_check.js +0 -490
  291. package/bin/static/js/mm_flexble.js +0 -112
  292. package/bin/static/js/mm_picker.js +0 -1417
  293. package/bin/static/js/mm_pinyinlite.js +0 -873
  294. package/bin/static/js/mm_sdk.js +0 -2841
  295. package/bin/static/js/mm_ui_expand.js +0 -468
  296. package/bin/static/js/mm_vue.js +0 -376
  297. package/bin/static/js/mm_vue_ui.js +0 -2375
  298. package/bin/static/js/mm_websocket.js +0 -145
  299. package/bin/static/js/require.js +0 -5
  300. package/bin/static/js/sortable.min.js +0 -3
  301. package/bin/static/js/swiper.min.js +0 -13
  302. package/bin/static/js/text.min.js +0 -1
  303. package/bin/static/js/vue-router.min.js +0 -6
  304. package/bin/static/js/vue.js +0 -12338
  305. package/bin/static/js/vuedraggable.min.js +0 -2
  306. package/bin/static/js/vuex.min.js +0 -6
  307. package/bin/static/src/components/bar/mm_action.vue +0 -19
  308. package/bin/static/src/components/bar/mm_buy.vue +0 -19
  309. package/bin/static/src/components/bar/mm_chat.vue +0 -18
  310. package/bin/static/src/components/bar/mm_count.vue +0 -18
  311. package/bin/static/src/components/bar/mm_filter.vue +0 -18
  312. package/bin/static/src/components/bar/mm_search.vue +0 -18
  313. package/bin/static/src/components/bar/mm_sort.vue +0 -18
  314. package/bin/static/src/components/bar/mm_tag.vue +0 -18
  315. package/bin/static/src/components/bar/mm_title.vue +0 -19
  316. package/bin/static/src/components/content/mm_pre.vue +0 -70
  317. package/bin/static/src/components/expand/mm_drag.vue +0 -39
  318. package/bin/static/src/components/item/mm_article.vue +0 -115
  319. package/bin/static/src/components/item/mm_base.vue +0 -26
  320. package/bin/static/src/components/item/mm_contact.vue +0 -25
  321. package/bin/static/src/components/item/mm_goods.vue +0 -23
  322. package/bin/static/src/components/item/mm_img.vue +0 -21
  323. package/bin/static/src/components/item/mm_media.vue +0 -18
  324. package/bin/static/src/components/item/mm_message.vue +0 -18
  325. package/bin/static/src/components/item/mm_music.vue +0 -95
  326. package/bin/static/src/components/item/mm_news.vue +0 -22
  327. package/bin/static/src/components/item/mm_number.vue +0 -26
  328. package/bin/static/src/components/item/mm_question.vue +0 -35
  329. package/bin/static/src/components/item/mm_user.vue +0 -22
  330. package/bin/static/src/components/item/mm_video.vue +0 -95
  331. package/bin/static/src/components/slide/mm_slide_card.vue +0 -64
  332. package/bin/static/src/components/slide/mm_slide_img.vue +0 -47
  333. package/bin/static/src/components/slide/mm_slide_page.vue +0 -8
  334. package/bin/static/src/components/slide/mm_slide_text.vue +0 -54
  335. package/bin/static/src/main.js +0 -84
  336. package/bin/static/src/mixins/form.js +0 -223
  337. package/bin/static/src/mixins/item.js +0 -242
  338. package/bin/static/src/mixins/list.js +0 -244
  339. package/bin/static/src/mixins/page.js +0 -1011
  340. package/bin/static/src/mm_component.js +0 -74
  341. package/bin/static/src/router.js +0 -72
  342. package/bin/static/src/store/user.js +0 -75
  343. package/bin/static/src/store/web.js +0 -50
  344. package/bin/static/user/1/number_info.xlsx +0 -0
  345. package/bin/static/w3c.html +0 -94
  346. package/init.js +0 -55
  347. package/update.md +0 -1
  348. /package/{bin → core}/com/api/README.md +0 -0
  349. /package/{bin → core}/com/api/rpc.js +0 -0
  350. /package/{bin → core}/com/db/README.md +0 -0
  351. /package/{bin → core}/com/event/README.md +0 -0
  352. /package/{bin/com/socket → core/com/mqtt}/README.md +0 -0
  353. /package/{bin → core}/com/nav/README.md +0 -0
  354. /package/{bin → core}/com/nav/config.tpl.json +0 -0
  355. /package/{bin → core}/com/param/README.md +0 -0
  356. /package/{bin → core}/com/param/index.js +0 -0
  357. /package/{bin → core}/com/param/script.js +0 -0
  358. /package/{bin → core}/com/param/test.js +0 -0
  359. /package/{bin → core}/com/plugin/README.md +0 -0
  360. /package/{bin → core}/com/plugin/script.js +0 -0
  361. /package/{bin → core}/com/sql/README.md +0 -0
  362. /package/{bin → core}/com/sql/index.js +0 -0
  363. /package/{bin → core}/com/sql/script.js +0 -0
  364. /package/{bin → core}/com/static/README.md +0 -0
  365. /package/{bin → core}/com/static/script.js +0 -0
  366. /package/{bin → core}/com/task/README.md +0 -0
  367. /package/{bin/rps.bat → rps.bat} +0 -0
  368. /package/{bin/tps.bat → tps.bat} +0 -0
@@ -1,1011 +0,0 @@
1
- define(function() {
2
- "use strict";
3
-
4
- return {
5
- data: function data() {
6
- return {
7
- // 标题
8
- title: "",
9
- // 地址
10
- url: "",
11
- // 添加地址
12
- url_add: "",
13
- // 删除地址
14
- url_del: "",
15
- // 修改地址
16
- url_set: "",
17
- // 查询对象地址
18
- url_get_obj: "",
19
- // 查询列表地址
20
- url_get_list: "",
21
- // 表单提交地址
22
- url_submit: "",
23
- // 上传提交地址
24
- url_upload: "",
25
- // 获取的列表
26
- list: [],
27
- // 视图&验证模型
28
- vm: {},
29
- // 提交表单
30
- form: {},
31
- // 线上对象
32
- obj: {},
33
- // 查询参数
34
- query: {
35
- // 当前页面
36
- // page: 1,
37
- // 页面大小
38
- // size: 10
39
- },
40
- // 配置
41
- config: {
42
- // 默认当前页面
43
- page: 1,
44
- // 默认页面大小
45
- size: 10
46
- },
47
- // 加载进度
48
- loading: 0,
49
- // 显示进度
50
- showing: 0,
51
- // 提交进度
52
- posting: 0,
53
- // 选中项
54
- select: $.db.get('select'),
55
- // 查询结果匹配数统计
56
- count: 0,
57
- // 显示隐藏,true显示,false隐藏
58
- show: false,
59
- // 响应成功或失败
60
- bl: false,
61
- // 显示方式
62
- display: "",
63
- // 关键字段
64
- field: "",
65
- // 响应提示
66
- tip: "",
67
- // 默认请求方式
68
- mode: "list",
69
- // 清除列表
70
- clear_list: true,
71
- // 响应错误消息
72
- message: "",
73
- // 选中集
74
- selects: "",
75
- // 当前页, 用于跳转页面
76
- page_now: 1,
77
- // 选择项状态
78
- select_state: false,
79
- // 排序键,用于拖拽修改排序
80
- sort_key: "display",
81
- // 修改条件
82
- query_set: {}
83
- };
84
- },
85
- methods: {
86
- /**
87
- * @description 事件管理, 用于管理函数
88
- * @param {String} name 事件名
89
- * @param {Object} param1 参数1
90
- * @param {Object} param2 参数2
91
- * @param {Object} param3 参数3
92
- * @return {Object} 返回事件特定值
93
- */
94
- events: function events(name, param1, param2, param3) {
95
- // console.log(name);
96
- if (this[name]) {
97
- if (param3) {
98
- return this[name](param1, param2, param3);
99
- } else {
100
- return this[name](param1, param2);
101
- }
102
- } else {
103
- return null;
104
- }
105
- },
106
- /**
107
- * 回调函数(中控)
108
- * @param {String} name 函数名
109
- * @param {Object} param1
110
- * @param {Object} param2
111
- * @param {Object} param3
112
- * @return {Object} 任意值
113
- */
114
- func: function func(name, param1, param2, param3) {
115
- var f = this[name];
116
- if (f) {
117
- if (param1 === undefined) {
118
- return f();
119
- } else if (param2 === undefined) {
120
- return f(param1);
121
- } else if (param3 === undefined) {
122
- return f(param1, param2);
123
- } else {
124
- return f(param1, param2, param3);
125
- }
126
- } else {
127
- return null;
128
- }
129
- },
130
- /**
131
- * @description 添加数据
132
- * @param {Object} param 要添加的数据
133
- * @param {Function} func 回调函数
134
- */
135
- add: function add(param, func) {
136
- if (!param) {
137
- param = this.obj;
138
- }
139
- var pm = this.events("add_before", param) || param;
140
- var msg = this.events("add_check", pm);
141
- var ret;
142
- if (!msg) {
143
- ret = this.events("add_main", pm, func);
144
- }
145
- return ret;
146
- },
147
- /**
148
- * @description 删除数据
149
- * @param {Object} param 查询条件
150
- */
151
- del: function del(param, func) {
152
- if (!param) {
153
- param = this.query;
154
- }
155
- var pm = this.events("del_before", param) || param;
156
- var msg = this.events("del_check", pm);
157
- var ret;
158
- if (!msg) {
159
- ret = this.events("del_main", pm, func);
160
- }
161
- return ret;
162
- },
163
- del_show: function(o, id) {
164
- var _this = this;
165
- $.confirm('删除后将无法回复!<br/>是否确定要删除?', function() {
166
- // console.log('确定删除!');
167
- var query = {};
168
- query[id] = o[id];
169
- _this.del(query, function() {
170
- _this.list.del(query);
171
- _this.count -= 1;
172
- });
173
- }, function() {
174
- // console.log('取消删除!')
175
- })
176
- },
177
- /**
178
- * @description 修改数据
179
- * @param {Object} param 修改项
180
- * @param {String} query 查询条件
181
- * @param {Boolean} includeZero 是否包括0
182
- */
183
- set: function set(param, query, func, includeZero) {
184
- if (!param) {
185
- param = this.obj;
186
- }
187
- if (query) {
188
- this.query_set = query;
189
- } else if (!this.query_set) {
190
- this.query_set = Object.assign({}, this.query);
191
- }
192
- var pm = this.events("set_before", param, includeZero) || param;
193
- var msg = this.events("set_check", pm);
194
- var ret;
195
- if (!msg) {
196
- ret = this.events("set_main", pm, func);
197
- }
198
- return ret;
199
- },
200
- /**
201
- * 修改前事件
202
- * @param {Object} param
203
- * @param {Boolean} includeZero 是否删除0值项
204
- * @param {Object} 返回新的参数
205
- */
206
- set_before: function set_before(param, includeZero) {
207
- var pm = $.delete(param, includeZero);
208
- for(var k in pm){
209
- if(k.toLocaleLowerCase().indexOf('time') !== -1 && pm[k].indexOf('T') !== -1){
210
- pm[k] = new Date(pm[k]).toStr('yyyy-MM-dd 00:00:00');
211
- }
212
- }
213
- return pm;
214
- },
215
- /**
216
- * 批量修改
217
- */
218
- batchSet: function batchSet() {
219
- var _this = this;
220
- $.confirm('批量修改数据无法挽回<br/>确定要操作吗?', function() {
221
- var q = Object.assign({}, _this.query, _this.query_set);
222
- q[_this.field] = _this.selects;
223
- delete q.page;
224
- delete q.size;
225
- delete q.orderby;
226
- _this.set(_this.form, q, function(json) {
227
- if (json.result) {
228
- _this.show = false;
229
- _this.get();
230
- }
231
- }, true);
232
- });
233
- },
234
- /**
235
- * @description 查询多条数据
236
- * @param {Object} query 查询条件
237
- * @param {Function} func 回调函数
238
- */
239
- get_list: function get_list(param, func) {
240
- if (!param) {
241
- param = this.query;
242
- }
243
- var pm = this.events("get_list_before", param) || param;
244
- var msg = this.events("get_list_check", pm);
245
- var ret;
246
- if (!msg) {
247
- ret = this.events("get_list_main", pm, func);
248
- }
249
- return ret;
250
- },
251
- /**
252
- * @description 查询一条数据
253
- * @param {Object} query 查询条件
254
- * @func {Function} 回调函数
255
- */
256
- get_obj: function get_obj(param, func) {
257
- if (!param) {
258
- param = this.query;
259
- }
260
- var pm = this.events("get_obj_before", param) || param;
261
- var msg = this.events("get_obj_check", pm);
262
- var ret;
263
- if (!msg) {
264
- ret = this.events("get_obj_main", pm, func);
265
- } else if (func) {
266
- func();
267
- }
268
- return ret;
269
- },
270
- sort: function sort(param, func) {
271
- var pm = this.events("sort_before", param) || param;
272
- var msg = this.events("sort_check", pm);
273
- var ret;
274
- if (!msg) {
275
- ret = this.events("sort_main", pm, func);
276
- }
277
- return ret;
278
- },
279
- init: function init(param, func) {
280
- var pm = this.events("init_before", param) || param;
281
- var msg = this.events("init_check", pm);
282
- var ret;
283
- if (!msg) {
284
- ret = this.events("init_main", pm, func);
285
- } else if (func) {
286
- func();
287
- }
288
- return ret;
289
- },
290
- submit: function submit(param, func) {
291
- if (!param) {
292
- param = this.form;
293
- }
294
- var pm = this.events("submit_before", param) || param;
295
- var msg = this.events("submit_check", pm);
296
- var ret;
297
- if (msg) {
298
- this.toast(msg);
299
- } else {
300
- ret = this.events("submit_main", pm, func);
301
- }
302
- return ret;
303
- },
304
- /**
305
- * 提交前事件
306
- * @param {Object} param 提交参数
307
- */
308
- submit_before: function(param) {
309
- return param;
310
- },
311
- upload: function upload(param, func) {
312
- var pm = this.events("upload_before", param) || param;
313
- var msg = this.events("upload_check", pm);
314
- var ret;
315
- if (msg) {
316
- this.toast(msg);
317
- } else {
318
- ret = this.events("upload_main", pm, func);
319
- }
320
- return ret;
321
- },
322
- /**
323
- * @description 提示框
324
- * @param {String} text 提示内容
325
- * @param {Number} longTime 显示时长
326
- */
327
- toast: function toast(text, longTime) {
328
- this.$.toast(text, longTime ? longTime : 2000);
329
- },
330
- /**
331
- * @description 添加数据
332
- * @param {Object} value 要添加的数据
333
- */
334
- add_main: function add_main(value, func) {
335
- var url = this.url ? this.url + "method=add" : this.url_add;
336
- if (!url) {
337
- return;
338
- }
339
- var _this = this;
340
- this.$post(url, value, function(json) {
341
- _this.events("add_after", json, func);
342
- if (json.result) {
343
- $.toast(json.result.tip);
344
- } else if (json.error) {
345
- $.toast(json.error.message);
346
- } else {
347
- $.toast('添加失败! 原因:是服务器连接失败!');
348
- }
349
- });
350
- },
351
- /**
352
- * @description 删除数据
353
- * @param {Object} query 查询条件
354
- * @param {Function} func 删除回调函数函数
355
- */
356
- del_main: function del_main(query, func) {
357
- var url = this.url ? this.url + "method=del" : this.url_del;
358
- if (!url) {
359
- return;
360
- }
361
- var _this = this;
362
- this.$get(url, query, function(json) {
363
- _this.events("del_after", json, func);
364
- if (json.result) {
365
- $.toast(json.result.tip);
366
- } else if (json.error) {
367
- $.toast(json.error.message);
368
- } else {
369
- $.toast('删除失败! 原因:是服务器连接失败!');
370
- }
371
- });
372
- },
373
- /**
374
- * 删除之后事件
375
- * @param {Object} json 返回的结果
376
- * @param {Object} func 回调函数
377
- */
378
- del_after: function del_after(json, func) {
379
- if (func) {
380
- func();
381
- }
382
- },
383
- /**
384
- * @description 修改数据
385
- * @param {Object} value 要修改的数据
386
- * @param {Object} value 修改项
387
- */
388
- set_main: function set_main(value, func) {
389
- var url = this.url ? this.url + "method=set" : this.url_set;
390
- if (!url) {
391
- return;
392
- }
393
- var _this = this;
394
- this.$post(this.toUrl(this.query_set, url), value, function(json, status) {
395
- _this.events("set_after", json, func);
396
- if (json.result) {
397
- $.toast(json.result.tip);
398
- } else if (json.error) {
399
- $.toast(json.error.message);
400
- } else {
401
- $.toast('修改失败! 原因:是服务器连接失败!');
402
- }
403
- });
404
- },
405
- /**
406
- * 修改成功时执行
407
- * @param {Object} json 结果
408
- * @param {Object} func 回调函数
409
- */
410
- set_after: function set_after(json, func) {
411
- if (func) {
412
- func(json);
413
- }
414
- },
415
- /**
416
- * @description 查询数据
417
- * @param {Object} query 查询参数
418
- * @param {Function} func 回调函数
419
- */
420
- get: function get(query, func) {
421
- this.get_main(query, func);
422
- },
423
- /**
424
- * @description 查询数据(主程序)
425
- * @param {Object} query 查询参数
426
- * @param {Function} func 回调函数
427
- */
428
- get_main: function get_main(query, func) {
429
- var url = this.url ? this.url : this.url_get_obj;
430
- if (url) {
431
- var _this = this;
432
- this.get_obj(query, function() {
433
- _this.get_create(query, func);
434
- });
435
- } else {
436
- this.get_create(query, func);
437
- }
438
- },
439
- /**
440
- * 验证请求
441
- * @param {Object} param 请求参数
442
- */
443
- get_obj_check: function get_obj_check(param) {
444
- var bl = false;
445
- for (var k in param) {
446
- if (param[k]) {
447
- bl = true;
448
- break;
449
- };
450
- }
451
- if (bl) {
452
- return null;
453
- } else {
454
- return "缺少查询条件";
455
- }
456
- },
457
- /**
458
- * @description 查询一条数据(主程序)
459
- * @param {Object} query 查询条件
460
- * @param {Function} func 回调函数
461
- */
462
- get_obj_main: function get_obj_main(query, func) {
463
- // console.log("get_obj_main");
464
- var url = this.url ? this.url + "method=get_obj" : this.url_get_obj;
465
- if (!url) {
466
- return;
467
- }
468
-
469
- var _this = this;
470
- this.$get(this.toUrl(query, url), null, function(json, status) {
471
- _this.events("get_obj_after", json, func);
472
- var res = json.result;
473
- if (res) {
474
- var obj;
475
- $.push(_this, res);
476
- if (res.obj) {
477
- obj = res.obj;
478
- } else {
479
- var list = res.list;
480
- if (list && list.length > 0) {
481
- obj = list[0];
482
- } else {
483
- obj = res;
484
- }
485
- }
486
- if (obj) {
487
- if (Object.keys(_this.obj).length === 0) {
488
- _this.obj = obj;
489
- } else {
490
- $.push(_this.obj, obj);
491
- }
492
- var o = _this.obj;
493
- for (var k in o) {
494
- if (k.indexOf('time') !== -1) {
495
- var val = o[k];
496
- if(val && val.indexOf('T') !== -1){
497
- var v = new Date(o[k]);
498
- o[k] = v.toStr('yyyy-MM-dd hh:mm:ss');
499
- }
500
- }
501
- }
502
- $.push(_this.form, _this.obj);
503
- }
504
- } else if (json.error) {
505
- console.log(json.error.message);
506
- } else {
507
- _this.toast("服务器连接失败!");
508
- }
509
- });
510
- },
511
- /**
512
- * @description 获取到对象后事件
513
- * @param {Object} json 响应结果
514
- */
515
- get_obj_after: function get_obj_after(json, func) {
516
- if (func) {
517
- func(json);
518
- }
519
- },
520
- /**
521
- * @description 查询多条数据(主程序)
522
- * @param {Object} query 查询条件
523
- * @param {Function} func 回调函数
524
- */
525
- get_list_main: function get_list_main(query, func) {
526
- var url = this.url ? this.url : this.url_get_list;
527
- if (!url) {
528
- return;
529
- }
530
- var _this = this;
531
- this.loading = 0;
532
- this.$get(this.toUrl(query, url), null, function(json, status) {
533
- _this.loading = 100;
534
- if (_this.clear_list) {
535
- _this.list.clear();
536
- }
537
- _this.events("get_list_after", json, func, url);
538
- var res = json.result;
539
- if (res) {
540
- _this.page_now = _this.query.page;
541
- _this.list.addList(res.list);
542
- if (res.count !== undefined) {
543
- _this.count = res.count;
544
- }
545
- } else if (json.error) {
546
- console.log(json.error.message);
547
- } else {
548
- _this.toast("服务器连接失败!");
549
- }
550
- });
551
- },
552
- /**
553
- * @description 获取到列表事件
554
- * @param {Object} res 响应结果
555
- */
556
- get_list_after: function get_list_after(res, func, url) {
557
- if (func) {
558
- func(res, url);
559
- }
560
- },
561
- /**
562
- * 搜索
563
- * @param {Object} query 查询条件
564
- * @param {Boolean} bl 是否重置再搜索
565
- */
566
- search: function search(query, func) {
567
- if (query) {
568
- $.push(this.query, query);
569
- }
570
- var url = this.url ? this.url : this.url_get_list;
571
- if(url){
572
- this.query.page = 1;
573
- this.count = 0;
574
- $.route.push("?" + this.toUrl(this.query));
575
- this.first(query, func);
576
- }
577
- },
578
- get_create: function get_create(query, func){
579
- if (query) {
580
- $.push(this.query, query);
581
- }
582
- var url = this.url ? this.url : this.url_get_list;
583
- if(url){
584
- this.count = 0;
585
- $.route.push("?" + this.toUrl(this.query));
586
- this.first(query, func);
587
- }
588
- },
589
- /**
590
- * @description 查询多条数据 (首次)
591
- * @param {Object} query 查询条件
592
- * @param {Function} func 回调函数
593
- */
594
- first: function first(query, func) {
595
- var _this = this;
596
- if (!this.count) {
597
- var qy = Object.assign({}, this.query, {
598
- count_ret: "true"
599
- });
600
- this.get_list(qy, func);
601
- } else {
602
- this.get_list(query, func);
603
- }
604
- },
605
- /**
606
- * @description 查询下一页数据
607
- * @param {Function} func 回调函数
608
- */
609
- next: function next(query, func) {
610
- console.log("next");
611
- var _this = this;
612
- _this.get_list(query, function(json, url) {
613
- if (json.result) {
614
- var list = json.result.list;
615
- if (list.length > 0) {
616
- var qy = Object.assign({}, query, {
617
- page: query.page + 1
618
- });
619
- if (qy.page <= _this.page_count) {
620
- delete qy.count_ret;
621
- _this.$get(_this.toUrl(qy, url));
622
- }
623
- }
624
- }
625
- if (func) {
626
- func(json);
627
- }
628
- });
629
- },
630
- /**
631
- * @description 查询上一页数据
632
- * @param {Function} func 回调函数
633
- */
634
- prev: function prev(query, func) {
635
- console.log("prev");
636
- var _this = this;
637
- this.get_list(query, function(json, url) {
638
- if (json.result) {
639
- var list = json.result.list;
640
- if (list.length > 0) {
641
- var qy = Object.assign({}, query, {
642
- page: query.page - 1
643
- });
644
- if (qy.page >= 1) {
645
- delete qy.count_ret;
646
- _this.$get(_this.toUrl(qy, url));
647
- }
648
- }
649
- }
650
- if (func) {
651
- func(res);
652
- }
653
- });
654
- },
655
- /**
656
- * 重置
657
- */
658
- reset: function reset() {
659
- $.clear(this.query);
660
- $.push(this.query, this.config);
661
- },
662
-
663
- /**
664
- * 提交表单
665
- */
666
- submit_main: function submit_main(param, func) {
667
- var url = this.url ? this.url : this.url_submit;
668
- if (url) {
669
- if (this.field) {
670
- var id = param[this.field];
671
- if (id) {
672
- var q = {
673
- method: 'set'
674
- };
675
- q[this.field] = id;
676
- url = this.toUrl(q, url);
677
- } else {
678
- url += "method=add"
679
- }
680
- } else {
681
- url += "method=submit"
682
- }
683
- } else {
684
- if (this.field) {
685
- var id = param[this.field];
686
- if (id) {
687
- url = this.url_set;
688
- } else {
689
- url = this.url_add;
690
- }
691
- }
692
- }
693
-
694
- // console.log('提交', url);
695
- if (url) {
696
- var _this = this;
697
- this.$post(url, param, function(json, status) {
698
- _this.events("submit_after", json, func);
699
- if (json.result) {
700
- _this.toast(json.result.tip);
701
- _this.$back();
702
- } else if (json.error) {
703
- _this.toast(json.error.message);
704
- } else {
705
- _this.toast("服务器连接失败!");
706
- }
707
- });
708
- }
709
- },
710
- /**
711
- * 提交前验证事件
712
- * @param {Object} 请求参数
713
- * @return {String} 验证成功返回null, 失败返回错误提示
714
- */
715
- submit_check: function submit_check(param) {
716
- return null;
717
- },
718
- /**
719
- * @description 获取到对象后事件
720
- * @param {Object} json 响应结果
721
- * @param {Function} func 回调函数
722
- */
723
- submit_after: function submit_after(json, func) {
724
- if (func) {
725
- func(json);
726
- }
727
- },
728
- /**
729
- * 上下翻页
730
- * @param {Number} n 加减页码
731
- */
732
- go: function go(n) {
733
- var page = this.query.page + n;
734
- this.goTo(page);
735
- },
736
- /**
737
- * 跳转指定页
738
- * @param {Number} page 页码
739
- */
740
- goTo: function goTo(page) {
741
- if (page < 1) {
742
- page = 1;
743
- } else if (page > this.page_count) {
744
- page = this.page_count;
745
- }
746
- var query = this.query;
747
- var p = query.page;
748
- query.page = page;
749
- this.$router.push("?" + this.toUrl(query));
750
- if (this.page_count !== 0) {
751
- if (p + 1 == page) {
752
- this.next(query);
753
- } else if (p - 1 == page) {
754
- this.prev(query);
755
- } else {
756
- this.first(query);
757
- }
758
- } else {
759
- this.first(query);
760
- }
761
- },
762
- /**
763
- * @description 转查询参数
764
- * @param {Object} obj 被转换的对象
765
- * @param {String} url 请求地址
766
- * @return {String} url字符串
767
- */
768
- toUrl: function toUrl(obj, url) {
769
- return $.toUrl(obj, url);
770
- },
771
- /**
772
- * 初始化前函数
773
- */
774
- init_before: function init_before(query) {
775
- if (!query) {
776
- query = this.config;
777
- }
778
- return query;
779
- },
780
- /**
781
- * 初始化
782
- */
783
- init_main: function init_main(query) {
784
- var _this = this;
785
- $.push(this.query, query);
786
- _this.init_after(function() {
787
- _this.get(_this.query);
788
- });
789
- },
790
- /**
791
- * 初始化后函数
792
- */
793
- init_after: function init_after(func) {
794
- if (func) {
795
- func();
796
- }
797
- },
798
- /**
799
- * @description 上传文件
800
- * @param {Function} func 回调函数
801
- */
802
- upload_main: function upload_main(func) {
803
- var url = "";
804
- if (this.url) {
805
- url = this.url + "method=upload";
806
- } else {
807
- url = this.url_upload;
808
- }
809
-
810
- if (!param) {
811
- param = this.form;
812
- }
813
- if (msg) {
814
- this.toast(msg);
815
- } else {
816
- this.uploading = 0;
817
- var _this = this;
818
- this.$upload(url, param, function(json, status) {
819
- _this.uploading = 100;
820
- _this.events("upload_after", json, func);
821
- });
822
- }
823
- },
824
- /**
825
- * @description 上传完成时
826
- * @param {Object} json 响应结果
827
- * @param {Function} func
828
- */
829
- upload_after: function upload_after(json, func) {
830
- if (json.result) {
831
- this.toast(json.result.tip);
832
- } else if (json.error) {
833
- this.toast(json.error.message);
834
- } else {
835
- this.toast("服务器连接失败!");
836
- }
837
- if (func) {
838
- func();
839
- }
840
- },
841
- /**
842
- * 结束前
843
- * @param {Object} param 参数
844
- */
845
- end_before: function end_before(param) {
846
- // this.reset();
847
- },
848
- /**
849
- * 选择项全改
850
- */
851
- select_all: function select_all() {
852
- var bl = !this.select_state;
853
- if (!bl) {
854
- this.selects = '';
855
- } else {
856
- var s = '';
857
- var list = this.list;;
858
- for (var i = 0; i < list.length; i++) {
859
- s += '|' + list[i][this.field];
860
- }
861
- this.selects = s.replace('|', '');
862
- }
863
- this.select_state = bl;
864
- },
865
- /**
866
- * 选择项改变
867
- * @param {String|Number} id 选择的ID
868
- */
869
- select_change: function select_change(id) {
870
- var has = false
871
- var arr = this.selects.split('|');
872
- for (var i = 0; i < arr.length; i++) {
873
- var o = arr[i];
874
- if (id == o) {
875
- arr.splice(i, 1);
876
- has = true;
877
- break;
878
- }
879
- }
880
- if (!has) {
881
- arr.push(id)
882
- }
883
- var s = arr.join('|');
884
- if (s.indexOf('|') == 0) {
885
- this.selects = s.substring(1)
886
- } else {
887
- this.selects = s;
888
- }
889
- },
890
- /**
891
- * 选择项含有
892
- * @param {String|Number} id 选择的ID
893
- */
894
- select_has: function select_has(id) {
895
- var ids = '|' + this.selects + '|';
896
- return ids.indexOf('|' + id + '|') !== -1;
897
- },
898
- /**
899
- * 选中
900
- * @param {Number} index 项目索引
901
- */
902
- selected: function selected(index) {
903
- this.select = index;
904
- $.db.set('select', index, 120);
905
- },
906
- /**
907
- * 页面改变时
908
- * @param {Object} e 事件
909
- */
910
- page_change: function page_change(e) {
911
- var n = Number(e.target.value);
912
- if (isNaN(n)) {
913
- n = 1;
914
- }
915
- if (n < 1) {
916
- n = 1;
917
- } else if (n > this.page_count) {
918
- n = this.page_count
919
- }
920
- this.page_now = n;
921
- },
922
- /**
923
- * 获取名称
924
- * @param {Array} list 用来取名的列表
925
- * @param {String} arr_str id集合
926
- * @param {String} key 键
927
- * @param {String} name 名
928
- * @param {String} span 分隔符
929
- */
930
- get_name(list, arr_str, key, name, span) {
931
- if(!name){
932
- name = "name";
933
- }
934
- var value = "";
935
- if (arr_str) {
936
- if (typeof(arr_str) == 'string') {
937
- if (!span) {
938
- span = ',';
939
- }
940
- var arr = arr_str.split(span);
941
- var id = Number(arr[0]);
942
-
943
- for (var i = 0; i < list.length; i++) {
944
- var o = list[i];
945
- if (o[key] == id) {
946
- value += '|' + o[name];
947
- }
948
- }
949
- } else {
950
- var id = arr_str;
951
- for (var i = 0; i < list.length; i++) {
952
- var o = list[i];
953
- if (o[key] == id) {
954
- value = o[name];
955
- break
956
- }
957
- }
958
- }
959
- }
960
- return value.replace('|', '');
961
- },
962
- /**
963
- * 取消并返回
964
- */
965
- cancel: function cancel() {
966
- this.$back();
967
- },
968
- /**
969
- * 排序改变事件
970
- * @param {Object} e 事件对象
971
- */
972
- sort_change: function sort_change(e){
973
- console.log(e);
974
- // var key = this.sort_key;
975
- // var obj = e.moved.element;
976
- // var id_1 = e.moved.oldIndex;
977
- // var id_2 = e.moved.newIndex
978
- // if(obj.hasOwnProperty(key)){
979
- // var o1 = this.list[id_1];
980
- // var o2 = this.list[id_2];
981
- // if(id_1 > id_2){
982
- // o2[key] = o1[key] - 1;
983
- // }
984
- // else {
985
- // o2[key] = o1[key] + 1;
986
- // }
987
- // this.set(o1);
988
- // this.set(o2);
989
- // }
990
- }
991
- },
992
- computed: {
993
- /**
994
- * 分页数量
995
- */
996
- page_count: function page_count() {
997
- return Math.ceil(this.count / this.query.size);
998
- }
999
- },
1000
- created: function created() {
1001
- this.showing = 0;
1002
- this.init(this.$route.query);
1003
- },
1004
- mounted: function mounted() {
1005
- this.showing = 100;
1006
- },
1007
- beforeDestroy: function beforeDestroy() {
1008
- this.events('end_before');
1009
- }
1010
- };
1011
- });