mm_os 4.3.7 → 5.0.1

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 (231) hide show
  1. package/README.md +102 -504
  2. package/index.js +26 -19
  3. package/lib/os.js +536 -0
  4. package/package.json +60 -84
  5. package/LICENSE +0 -21
  6. package/README_EN.md +0 -505
  7. package/adapter/adapter.js +0 -484
  8. package/adapter/custom_persistence.js +0 -661
  9. package/adapter/mqtt.js +0 -254
  10. package/adapter/socket.js +0 -244
  11. package/adapter/web.js +0 -92
  12. package/adapter/websocket.js +0 -43
  13. package/ai.js +0 -130
  14. package/com/api/README.md +0 -3
  15. package/com/api/com.json +0 -5
  16. package/com/api/config.tpl.json +0 -41
  17. package/com/api/drive.js +0 -732
  18. package/com/api/index.js +0 -201
  19. package/com/api/oauth.js +0 -200
  20. package/com/api/script.tpl.js +0 -32
  21. package/com/cmd/README.md +0 -11
  22. package/com/cmd/com.json +0 -5
  23. package/com/cmd/config.tpl.json +0 -48
  24. package/com/cmd/drive.js +0 -176
  25. package/com/cmd/index.js +0 -287
  26. package/com/cmd/job/config.json +0 -66
  27. package/com/cmd/job/index.js +0 -241
  28. package/com/cmd/job/test.js +0 -188
  29. package/com/cmd/msg.json +0 -48
  30. package/com/cmd/script.tpl.js +0 -12
  31. package/com/db/README.md +0 -3
  32. package/com/db/com.json +0 -5
  33. package/com/db/drive.js +0 -2206
  34. package/com/db/index.js +0 -241
  35. package/com/event/README.md +0 -4
  36. package/com/event/com.json +0 -5
  37. package/com/event/config.tpl.json +0 -20
  38. package/com/event/drive.js +0 -61
  39. package/com/event/index.js +0 -438
  40. package/com/event/script.tpl.js +0 -23
  41. package/com/mqtt/README.md +0 -47
  42. package/com/mqtt/com.json +0 -5
  43. package/com/mqtt/config.tpl.json +0 -42
  44. package/com/mqtt/drive.js +0 -704
  45. package/com/mqtt/index.js +0 -1052
  46. package/com/mqtt/index.test.js +0 -503
  47. package/com/mqtt/script.tpl.js +0 -719
  48. package/com/nav/README.md +0 -2
  49. package/com/nav/com.json +0 -5
  50. package/com/nav/config.tpl.json +0 -84
  51. package/com/nav/drive.js +0 -702
  52. package/com/nav/index.js +0 -228
  53. package/com/nav/tpl/admin_pc/page_channel.vue +0 -305
  54. package/com/nav/tpl/admin_pc/page_config.vue +0 -280
  55. package/com/nav/tpl/admin_pc/page_config_form.vue +0 -194
  56. package/com/nav/tpl/admin_pc/page_default.vue +0 -247
  57. package/com/nav/tpl/admin_pc/page_form.vue +0 -180
  58. package/com/nav/tpl/admin_pc/page_lang.vue +0 -264
  59. package/com/nav/tpl/admin_pc/page_nav.vue +0 -321
  60. package/com/nav/tpl/admin_pc/page_table.vue +0 -296
  61. package/com/nav/tpl/admin_pc/page_type.vue +0 -321
  62. package/com/nav/tpl/admin_pc/page_view.vue +0 -124
  63. package/com/nav/tpl/dev_pc/page_channel.vue +0 -253
  64. package/com/nav/tpl/dev_pc/page_config.vue +0 -253
  65. package/com/nav/tpl/dev_pc/page_default.vue +0 -247
  66. package/com/nav/tpl/dev_pc/page_form.vue +0 -162
  67. package/com/nav/tpl/dev_pc/page_nav.vue +0 -253
  68. package/com/nav/tpl/dev_pc/page_table.vue +0 -247
  69. package/com/nav/tpl/dev_pc/page_type.vue +0 -313
  70. package/com/nav/tpl/home_pc/page_channel.vue +0 -234
  71. package/com/nav/tpl/home_pc/page_default.vue +0 -234
  72. package/com/nav/tpl/home_pc/page_form.vue +0 -137
  73. package/com/nav/tpl/home_pc/page_list.vue +0 -234
  74. package/com/nav/tpl/home_pc/page_nav.vue +0 -221
  75. package/com/nav/tpl/home_pc/page_type.vue +0 -234
  76. package/com/nav/tpl/home_pc/page_view.vue +0 -125
  77. package/com/nav/tpl/home_phone/page_channel.vue +0 -234
  78. package/com/nav/tpl/home_phone/page_default.vue +0 -234
  79. package/com/nav/tpl/home_phone/page_form.vue +0 -137
  80. package/com/nav/tpl/home_phone/page_list.vue +0 -234
  81. package/com/nav/tpl/home_phone/page_nav.vue +0 -237
  82. package/com/nav/tpl/home_phone/page_type.vue +0 -234
  83. package/com/nav/tpl/home_phone/page_view.vue +0 -125
  84. package/com/nav/viewmodel.js +0 -446
  85. package/com/param/README.md +0 -2
  86. package/com/param/com.json +0 -5
  87. package/com/param/config.tpl.json +0 -136
  88. package/com/param/drive.js +0 -502
  89. package/com/param/index.js +0 -158
  90. package/com/param/script.tpl.js +0 -12
  91. package/com/pendant/README.md +0 -3
  92. package/com/pendant/com.json +0 -5
  93. package/com/pendant/config.tpl.json +0 -32
  94. package/com/pendant/drive.js +0 -204
  95. package/com/pendant/index.js +0 -467
  96. package/com/pendant/pendant.html +0 -16
  97. package/com/pendant/script.tpl.js +0 -18
  98. package/com/socket/README.md +0 -47
  99. package/com/socket/com.json +0 -5
  100. package/com/socket/config.tpl.json +0 -12
  101. package/com/socket/drive.js +0 -679
  102. package/com/socket/index.js +0 -402
  103. package/com/socket/script.tpl.js +0 -41
  104. package/com/sql/README.md +0 -3
  105. package/com/sql/com.json +0 -5
  106. package/com/sql/config.tpl.json +0 -74
  107. package/com/sql/drive.js +0 -1328
  108. package/com/sql/index.js +0 -152
  109. package/com/sql/script.tpl.js +0 -47
  110. package/com/static/README.md +0 -2
  111. package/com/static/com.json +0 -5
  112. package/com/static/config.tpl.json +0 -24
  113. package/com/static/drive.js +0 -194
  114. package/com/static/index.js +0 -237
  115. package/com/static/script.tpl.js +0 -28
  116. package/com/task/README.md +0 -3
  117. package/com/task/com.json +0 -5
  118. package/com/task/config.tpl.json +0 -24
  119. package/com/task/drive.js +0 -428
  120. package/com/task/index.js +0 -159
  121. package/com/task/script.tpl.js +0 -40
  122. package/com/template/com.json +0 -5
  123. package/com/template/config.tpl.json +0 -16
  124. package/com/template/drive.js +0 -81
  125. package/com/template/index.js +0 -141
  126. package/com.js +0 -237
  127. package/common/README.md +0 -2
  128. package/common/middleware/web_after/index.js +0 -26
  129. package/common/middleware/web_after/middleware.json +0 -9
  130. package/common/middleware/web_base/index.js +0 -113
  131. package/common/middleware/web_base/middleware.json +0 -19
  132. package/common/middleware/web_before/index.js +0 -33
  133. package/common/middleware/web_before/middleware.json +0 -9
  134. package/common/middleware/web_cors/index.js +0 -87
  135. package/common/middleware/web_cors/middleware.json +0 -24
  136. package/common/middleware/web_error/index.js +0 -131
  137. package/common/middleware/web_error/middleware.json +0 -19
  138. package/common/middleware/web_ip/index.js +0 -15
  139. package/common/middleware/web_ip/middleware.json +0 -14
  140. package/common/middleware/web_logger/index.js +0 -156
  141. package/common/middleware/web_logger/middleware.json +0 -14
  142. package/common/middleware/web_main/index.js +0 -26
  143. package/common/middleware/web_main/middleware.json +0 -9
  144. package/common/middleware/web_static/index.js +0 -73
  145. package/common/middleware/web_static/middleware.json +0 -54
  146. package/common/middleware/web_waf/index.js +0 -395
  147. package/common/middleware/web_waf/middleware.json +0 -13
  148. package/core/app/config.tpl.json +0 -67
  149. package/core/app/index.js +0 -711
  150. package/core/app/script.tpl.js +0 -52
  151. package/core/channel/index.js +0 -899
  152. package/core/channel/matcher.js +0 -585
  153. package/core/com/config.tpl.json +0 -16
  154. package/core/com/index.js +0 -77
  155. package/core/com/script.tpl.js +0 -5
  156. package/core/component/component.js +0 -42
  157. package/core/component/config.tpl.json +0 -63
  158. package/core/component/index.js +0 -273
  159. package/core/component/script.tpl.js +0 -19
  160. package/core/controller/config.tpl.json +0 -14
  161. package/core/controller/index.js +0 -371
  162. package/core/controller/script.tpl.js +0 -27
  163. package/core/factory/config.tpl.json +0 -14
  164. package/core/factory/entity.js +0 -275
  165. package/core/factory/index.js +0 -241
  166. package/core/factory/script.tpl.js +0 -16
  167. package/core/game/bat/index.js +0 -137
  168. package/core/game/bat/world.js +0 -622
  169. package/core/game/config.tpl.json +0 -16
  170. package/core/game/entity_admin.js +0 -230
  171. package/core/game/index.js +0 -186
  172. package/core/handler/config.tpl.json +0 -22
  173. package/core/handler/index.js +0 -181
  174. package/core/handler/script.tpl.js +0 -23
  175. package/core/logic/config.tpl.json +0 -14
  176. package/core/logic/index.js +0 -59
  177. package/core/logic/script.tpl.js +0 -19
  178. package/core/middleware/config.tpl.json +0 -16
  179. package/core/middleware/index.js +0 -117
  180. package/core/middleware/script.tpl.js +0 -37
  181. package/core/mod/config.tpl.json +0 -22
  182. package/core/mod/index.js +0 -136
  183. package/core/mod/script.tpl.js +0 -34
  184. package/core/model/config.tpl.json +0 -219
  185. package/core/model/index.js +0 -272
  186. package/core/model/model.js +0 -27
  187. package/core/model/script.tpl.js +0 -20
  188. package/core/notifier/config.tpl.json +0 -14
  189. package/core/notifier/index.js +0 -77
  190. package/core/notifier/script.tpl.js +0 -20
  191. package/core/plugin/config.tpl.json +0 -36
  192. package/core/plugin/index.js +0 -267
  193. package/core/plugin/script.tpl.js +0 -51
  194. package/core/pusher/config.tpl.json +0 -14
  195. package/core/pusher/index.js +0 -158
  196. package/core/pusher/script.tpl.js +0 -20
  197. package/core/room/bat/index.js +0 -170
  198. package/core/room/bat/room.js +0 -524
  199. package/core/room/config.tpl.json +0 -20
  200. package/core/room/index.js +0 -249
  201. package/core/room/room.js +0 -61
  202. package/core/scene/config.tpl.json +0 -14
  203. package/core/scene/index.js +0 -467
  204. package/core/scene/loop.js +0 -1306
  205. package/core/scene/map.js +0 -28
  206. package/core/scene/script.tpl.js +0 -22
  207. package/core/sender/config.tpl.json +0 -14
  208. package/core/sender/index.js +0 -79
  209. package/core/sender/script.tpl.js +0 -20
  210. package/core/service/config.tpl.json +0 -14
  211. package/core/service/index.js +0 -100
  212. package/core/service/script.tpl.js +0 -25
  213. package/core/store/config.tpl.json +0 -26
  214. package/core/store/index.js +0 -1794
  215. package/core/store/script.tpl.js +0 -22
  216. package/core/system/config.tpl.json +0 -18
  217. package/core/system/index.js +0 -312
  218. package/core/system/script.tpl.js +0 -77
  219. package/core/view/config.tpl.json +0 -14
  220. package/core/view/index.js +0 -91
  221. package/core/view/script.tpl.js +0 -20
  222. package/core/zone/bat/index.js +0 -744
  223. package/core/zone/config.tpl.json +0 -54
  224. package/core/zone/index.js +0 -655
  225. package/core/zone/script.tpl.js +0 -10
  226. package/core/zone/zone_bat.js +0 -136
  227. package/core//345/237/272/347/261/273/346/250/241/345/235/227/346/270/205/345/215/225.md +0 -24
  228. package/os.js +0 -53
  229. package/server.js +0 -602
  230. package/ulits/id_gen.js +0 -134
  231. package/ulits/word.js +0 -206
@@ -1,237 +0,0 @@
1
- <template>
2
- <main id="${id}">
3
- <mm_grid>
4
- <mm_col>
5
- <mm_view>
6
- <header class="arrow">
7
- <h5>${api.title}</h5>
8
- </header>
9
- <mm_body>
10
- <mm_form class="bar_filter">
11
- <h5><span>筛选条件</span></h5>
12
- <mm_list :col="3">
13
- <!--{if(param.list)}-->
14
- <!--{loop param.list v idx}-->
15
- <!--{if(v.name == 'keyword')}-->
16
- <mm_col>
17
- <control_input v-model="query.keyword" title="${v.title}"
18
- desc="${v.description.replace(/\([0-9A-Za-z_]+\)/g, '').replace('用于搜索', '').replace(/、/g, ' / ')}"
19
- @blur="search()" />
20
- </mm_col>
21
- <!--{/if}-->
22
- <!--{/loop}-->
23
- <!--{/if}-->
24
- <!--{loop field v idx}-->
25
- <!--{if(v.format)}-->
26
- <!--{if(v.format.table)}-->
27
- <mm_col>
28
- <control_select v-model="query.${v.format.key}" title="${v.title}"
29
- :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')"
30
- @change="search()" />
31
- </mm_col>
32
- <!--{else}-->
33
- <mm_col>
34
- <control_select v-model="query.${v.format.key}" title="${v.title}"
35
- :options="$to_kv(${v.label})" @change="search()" />
36
- </mm_col>
37
- <!--{/if}-->
38
- <!--{/if}-->
39
- <!--{/loop}-->
40
- <mm_col>
41
- <mm_btn class="btn-primary-x" type="reset" @click.native="reset();search()">重置
42
- </mm_btn>
43
- </mm_col>
44
- </mm_list>
45
- </mm_form>
46
- <div class="bar_action">
47
- <h5><span>操作</span></h5>
48
- <div class="">
49
- <mm_btn class="btn-primary-x" url="./${name}_form?">添加</mm_btn>
50
- <mm_btn @click.native="show = true" class="btn-primary-x"
51
- v-bind:class="{ 'disabled': !selects }">批量修改</mm_btn>
52
- </div>
53
- </div>
54
- <mm_table type="2">
55
- <thead>
56
- <tr>
57
- <th scope="col" class="th_selected"><input type="checkbox" :checked="select_state"
58
- @click="select_all()" /></th>
59
- <th scope="col" class="th_id"><span>#</span></th>
60
- <!--{loop field v idx}-->
61
- <!--{if(idx > 0)}-->
62
- <th scope="col">
63
- <control_reverse title="${v.title}" v-model="query.orderby" field="${v.name}"
64
- :func="search"></control_reverse>
65
- </th>
66
- <!--{/if}-->
67
- <!--{/loop}-->
68
- <th scope="col" class="th_handle"><span>操作</span></th>
69
- </tr>
70
- </thead>
71
- <tbody>
72
- <tr v-for="(o, idx) in list" :key="idx">
73
- <th scope="row"><input type="checkbox" :checked="select_has(o[field])"
74
- @click="select_change(o[field])" /></th>
75
- <th scope="row"><span>{{ o[field] }}</span></th>
76
- <!--{loop field v idx}-->
77
- <!--{if(v.format)}-->
78
- <!--{if(v.format.table)}-->
79
- <td><span>{{ $get_name(${v.label}, o.${v.format.key}, '${v.format.id || v.format.key}', '${v.format.name}') }}</span>
80
- </td>
81
- <!--{else}-->
82
- <td><span>{{ ${v.label}[o.${v.name}] }}</span></td>
83
- <!--{/if}-->
84
- <!--{else if(v.name.indexOf('time') !== -1 || v.name.indexOf('Time') !== -1)}-->
85
- <td><span>{{ $to_time(o.${v.name}, 'yyyy-MM-dd hh:mm') }}</span></td>
86
- <!--{else if(idx > 0)}-->
87
- <td><span>{{ o.${v.name} }}</span></td>
88
- <!--{/if}-->
89
- <!--{/loop}-->
90
- <td>
91
- <mm_btn class="btn-primary" :url="'./${name}_form?${sql.key}=' + o[field]">修改
92
- </mm_btn>
93
- <mm_btn class="btn_warning" @click.native="del_show(o, field)">删除</mm_btn>
94
- </td>
95
- </tr>
96
- </tbody>
97
- </mm_table>
98
- </mm_body>
99
- <footer>
100
- <mm_grid class="mm_data_count">
101
- <mm_col>
102
- <control_select v-model="query.size" :options="$to_size()" @change="search()" />
103
- </mm_col>
104
- <mm_col width="50" style="min-width: 22.5rem;">
105
- <control_pager display="2" v-model="query.page" :count="count / query.size" :func="goTo"
106
- :icons="['首页', '上一页', '下一页', '尾页']"></control_pager>
107
- </mm_col>
108
- <mm_col>
109
- <div class="right plr">
110
- <span class="mr">共 {{ count }} 条</span>
111
- <span>当前</span>
112
- <input class="pager_now" v-model.number="page_now" @blur="goTo(page_now)"
113
- @change="page_change" />
114
- <span>/{{ page_count }}页</span>
115
- </div>
116
- </mm_col>
117
- </mm_grid>
118
- </footer>
119
- </mm_view>
120
- </mm_col>
121
- </mm_grid>
122
- <mm_modal v-model="show" mask="true">
123
- <mm_view class="card bg_no">
124
- <header class="bg_white">
125
- <h5>批量修改</h5>
126
- </header>
127
- <mm_body>
128
- <dl>
129
- <!--{loop field v idx}-->
130
- <!--{if(v.format)}-->
131
- <dt>${v.title}</dt>
132
- <!--{if(v.format.table)}-->
133
- <dd>
134
- <control_select v-model="form.${v.format.key}"
135
- :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
136
- </dd>
137
- <!--{else}-->
138
- <dd>
139
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label})" />
140
- </dd>
141
- <!--{/if}-->
142
- <!--{/if}-->
143
- <!--{/loop}-->
144
- </dl>
145
- </mm_body>
146
- <footer>
147
- <div class="mm_group">
148
- <button class="btn_default" type="reset" @click="show = false">取消</button>
149
- <button class="btn-primary" type="button" @click="batchSet()">提交</button>
150
- </div>
151
- </footer>
152
- </mm_view>
153
- </mm_modal>
154
- </main>
155
- </template>
156
-
157
- <script>
158
- import mixin from '/src/mixins/page.js';
159
-
160
- export default {
161
- mixins: [mixin],
162
- data() {
163
- return {
164
- // 列表请求地址
165
- url_get_list: "${api.path}",
166
- url_del: "${api.path}?method=del&",
167
- url_set: "${api.path}?method=set&",
168
- field: "${sql.key}",
169
- query_set: {
170
- "${sql.key}": ""
171
- },
172
- // 查询条件
173
- query: {
174
- //页码
175
- page: 1,
176
- //页面大小
177
- size: 10,
178
- /*[loop js.query v idx]*/
179
- // ${' ' + v.title}
180
- /*[if v.type == 'string']*/
181
- '${v.name}': '',
182
- /*[else]*/
183
- '${v.name}': 0,
184
- /*[/if]*/
185
- /*[/loop]*/
186
- //排序
187
- orderby: ""
188
- },
189
- form: {},
190
- //颜色
191
- arr_color: ['', 'font_success', 'font_warning', 'font_yellow', 'font_default'],
192
- /*[loop js.data v idx]*/
193
- // ${' ' + v.title}
194
- '${v.name}': [ /*[loop v.value a idx]*/ /*[if idx == 0]*/ '${a}' /*[else]*/ ,
195
- '${a}' /*[/if]*/ /*[/loop]*/ ],
196
- /*[/loop]*/
197
- // 视图模型
198
- vm: {}
199
- }
200
- },
201
- methods: {
202
- /*[loop js.data v idx]*/
203
- /*[if(v.path)]*/
204
- /**
205
- * 获取 ${v.title}
206
- * @param {query} 查询条件
207
- */
208
- get_ /*[v.basename]*/(query) {
209
- var _this = this;
210
- if (!query) {
211
- query = {
212
- field: "${v.id},${v.field}"
213
- };
214
- }
215
- this.$get('~${v.path}', query, function(json) {
216
- if (json.result) {
217
- _this /*['.' + v.name]*/ .clear();
218
- _this /*['.' + v.name]*/ .addList(json.result.list)
219
- }
220
- });
221
- },
222
- /*[/if]*/
223
- /*[/loop]*/
224
- },
225
- created() {
226
- /*[loop js.data v idx]*/
227
- /*[if(v.path)]*/
228
- // 获取 ${v.title}
229
- this.get_ /*[v.basename]*/();
230
- /*[/if]*/
231
- /*[/loop]*/
232
- }
233
- }
234
- </script>
235
-
236
- <style>
237
- </style>
@@ -1,234 +0,0 @@
1
- <template>
2
- <main id="${id}">
3
- <mm_grid>
4
- <mm_col>
5
- <mm_view>
6
- <header class="arrow">
7
- <h5>${api.title}</h5>
8
- </header>
9
- <mm_body>
10
- <mm_form class="bar_filter">
11
- <h5><span>筛选条件</span></h5>
12
- <mm_list :col="3">
13
- <!--{if(param.list)}-->
14
- <!--{loop param.list v idx}-->
15
- <!--{if(v.name == 'keyword')}-->
16
- <mm_col>
17
- <control_input v-model="query.keyword" title="${v.title}" desc="${v.description.replace(/\([0-9A-Za-z_]+\)/g, '').replace('用于搜索', '').replace(/、/g, ' / ')}" @blur="search()" />
18
- </mm_col>
19
- <!--{/if}-->
20
- <!--{/loop}-->
21
- <!--{/if}-->
22
- <!--{loop field v idx}-->
23
- <!--{if(v.format)}-->
24
- <!--{if(v.format.table)}-->
25
- <mm_col>
26
- <control_select v-model="query.${v.format.key}" title="${v.title}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" @change="search()" />
27
- </mm_col>
28
- <!--{else}-->
29
- <mm_col>
30
- <control_select v-model="query.${v.format.key}" title="${v.title}" :options="$to_kv(${v.label})" @change="search()" />
31
- </mm_col>
32
- <!--{/if}-->
33
- <!--{/if}-->
34
- <!--{/loop}-->
35
- <mm_col>
36
- <mm_btn class="btn-primary-x" type="reset" @click.native="reset();search()">重置</mm_btn>
37
- </mm_col>
38
- </mm_list>
39
- </mm_form>
40
- <div class="bar_action">
41
- <h5><span>操作</span></h5>
42
- <div class="">
43
- <mm_btn class="btn-primary-x" url="./${name}_form?">添加</mm_btn>
44
- <mm_btn @click.native="show = true" class="btn-primary-x" v-bind:class="{ 'disabled': !selects }">批量修改</mm_btn>
45
- </div>
46
- </div>
47
- <mm_table type="2">
48
- <thead>
49
- <tr>
50
- <th scope="col" class="th_selected"><input type="checkbox" :checked="select_state" @click="select_all()" /></th>
51
- <th scope="col" class="th_id"><span>#</span></th>
52
- <!--{loop field v idx}-->
53
- <!--{if(idx > 0)}-->
54
- <th scope="col">
55
- <control_reverse title="${v.title}" v-model="query.orderby" field="${v.name}" :func="search"></control_reverse>
56
- </th>
57
- <!--{/if}-->
58
- <!--{/loop}-->
59
- <th scope="col" class="th_handle"><span>操作</span></th>
60
- </tr>
61
- </thead>
62
- <tbody>
63
- <tr v-for="(o, idx) in list" :key="idx">
64
- <th scope="row"><input type="checkbox" :checked="select_has(o[field])" @click="select_change(o[field])" /></th>
65
- <!--{loop field v idx}-->
66
- <td>
67
- <!--{if(v.dataType === 'tinyint')}-->
68
- <control_switch v-model="o.${v.name}" @click.native="set(o)" />
69
- <!--{else if(v.format)}-->
70
- <!--{if(v.format.table)}-->
71
- <span>{{ $get_name(${v.label}, o.${v.format.key}, '${v.format.id || v.format.key}', '${v.format.name}') }}</span>
72
- <!--{else if(v.name == 'state' || v.name == 'status')}-->
73
- <span v-bind:class="arr_color[o.${v.name}]">{{ ${v.label}[o.${v.name}] }}</span>
74
- <!--{else}-->
75
- <span>{{ ${v.label}[o.${v.name}] }}</span>
76
- <!--{/if}-->
77
- <!--{else if(v.name.indexOf('img') !== -1 || v.name.indexOf('icon') !== -1)}-->
78
- <img :src="o.${v.name}" alt="${v.title}" />
79
- <!--{else if(v.dataType === 'date')}-->
80
- <span>{{ $to_time(o.${v.name}, 'yyyy-MM-dd') }}</span>
81
- <!--{else if(v.dataType === 'time')}-->
82
- <span>{{ o.${v.name} }}</span>
83
- <!--{else if(v.dataType === 'timestamp' || v.dataType === 'datetime')}-->
84
- <span>{{ $to_time(o.${v.name}, 'yyyy-MM-dd hh:mm') }}</span>
85
- <!--{else if(v.name === 'display' || v.name === 'orderby')}-->
86
- <input class="input_display" v-model.number="o.${v.name}" @blur="set(o)" min="0" max="1000" />
87
- <!--{else}-->
88
- <span>{{ o.${v.name} }}</span>
89
- <!--{/if}-->
90
- </td>
91
- <!--{/loop}-->
92
- <td>
93
- <mm_btn class="btn-primary" :url="'./${name}_form?${sql.key}=' + o[field]">修改</mm_btn>
94
- <mm_btn class="btn_warning" @click.native="del_show(o, field)">删除</mm_btn>
95
- </td>
96
- </tr>
97
- </tbody>
98
- </mm_table>
99
- </mm_body>
100
- <footer>
101
- <mm_grid class="mm_data_count">
102
- <mm_col>
103
- <control_select v-model="query.size" :options="$to_size()" @change="search()" />
104
- </mm_col>
105
- <mm_col width="50" style="min-width: 22.5rem;">
106
- <control_pager display="2" v-model="query.page" :count="count / query.size" :func="goTo" :icons="['首页', '上一页', '下一页', '尾页']"></control_pager>
107
- </mm_col>
108
- <mm_col>
109
- <div class="right plr">
110
- <span class="mr">共 {{ count }} 条</span>
111
- <span>当前</span>
112
- <input class="pager_now" v-model.number="page_now" @blur="goTo(page_now)" @change="page_change" />
113
- <span>/{{ page_count }}页</span>
114
- </div>
115
- </mm_col>
116
- </mm_grid>
117
- </footer>
118
- </mm_view>
119
- </mm_col>
120
- </mm_grid>
121
- <mm_modal v-model="show" mask="true">
122
- <mm_view class="card bg_no">
123
- <header class="bg_white">
124
- <h5>批量修改</h5>
125
- </header>
126
- <mm_body>
127
- <dl>
128
- <!--{loop field v idx}-->
129
- <!--{if(v.format)}-->
130
- <dt>${v.title}</dt>
131
- <!--{if(v.format.table)}-->
132
- <dd>
133
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
134
- </dd>
135
- <!--{else}-->
136
- <dd>
137
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label})" />
138
- </dd>
139
- <!--{/if}-->
140
- <!--{/if}-->
141
- <!--{/loop}-->
142
- </dl>
143
- </mm_body>
144
- <footer>
145
- <div class="mm_group">
146
- <button class="btn_default" type="reset" @click="show = false">取消</button>
147
- <button class="btn-primary" type="button" @click="batchSet()">提交</button>
148
- </div>
149
- </footer>
150
- </mm_view>
151
- </mm_modal>
152
- </main>
153
- </template>
154
-
155
- <script>
156
- import mixin from '/src/mixins/page.js';
157
-
158
- export default {
159
- mixins: [mixin],
160
- data() {
161
- return {
162
- // 列表请求地址
163
- url_get_list: "${api.path}",
164
- url_del: "${api.path}?method=del&",
165
- url_set: "${api.path}?method=set&",
166
- field: "${sql.key}",
167
- query_set: {
168
- "${sql.key}": ""
169
- },
170
- // 查询条件
171
- query: {
172
- //页码
173
- page: 1,
174
- //页面大小
175
- size: 10,
176
- /*[loop js.query v idx]*/
177
- // ${' ' + v.title}
178
- /*[if v.type === 'number' && !v.select]*/
179
- '${v.name}': 0,
180
- /*[else]*/
181
- '${v.name}': '',
182
- /*[/if]*/
183
- /*[/loop]*/
184
- //排序
185
- orderby: ""
186
- },
187
- form: {},
188
- //颜色
189
- arr_color: ['', '', 'font_yellow', 'font_success', 'font_warning', 'font_primary', 'font_info', 'font_default'],
190
- /*[loop js.data v idx]*/
191
- // ${' ' + v.title}
192
- '${v.name}': [/*[loop v.value a idx]*//*[if idx == 0]*/'${a}'/*[else]*/,'${a}'/*[/if]*//*[/loop]*/],
193
- /*[/loop]*/
194
- // 视图模型
195
- vm: {}
196
- }
197
- },
198
- methods: {
199
- /*[loop js.data v idx]*/
200
- /*[if(v.path)]*/
201
- /**
202
- * 获取 ${v.title}
203
- * @param {query} 查询条件
204
- */
205
- get_/*[v.basename]*/(query){
206
- var _this = this;
207
- if(!query){
208
- query = {
209
- field: "${v.id},${v.field}"
210
- };
211
- }
212
- this.$get('~${v.path}', query, function(json) {
213
- if (json.result) {
214
- _this/*['.' + v.name]*/.clear();
215
- _this/*['.' + v.name]*/.addList(json.result.list)
216
- }
217
- });
218
- },
219
- /*[/if]*/
220
- /*[/loop]*/
221
- },
222
- created() {
223
- /*[loop js.data v idx]*/
224
- /*[if(v.path)]*/
225
- // 获取 ${v.title}
226
- this.get_/*[v.basename]*/();
227
- /*[/if]*/
228
- /*[/loop]*/
229
- }
230
- }
231
- </script>
232
-
233
- <style>
234
- </style>
@@ -1,125 +0,0 @@
1
- <template>
2
- <main id="${id}">
3
- <mm_grid>
4
- <mm_col>
5
- <mm_form class="card">
6
- <header class="arrow">
7
- <h5>{{ form[field] ? '修改' : '创建' }}${api.title}</h5>
8
- </header>
9
- <dl>
10
- <!--{loop field v idx}-->
11
- <!--{if idx > 0}-->
12
- <dt>${v.title}</dt>
13
- <!--{if(v.format)}-->
14
- <!--{if(v.format.table)}-->
15
- <dd>
16
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
17
- </dd>
18
- <!--{else}-->
19
- <dd>
20
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label})" />
21
- </dd>
22
- <!--{/if}-->
23
- <!--{else if(v.dataType.indexOf('time') !== -1 || v.dataType.indexOf('date') !== -1)}-->
24
- <dd>
25
- <mm_time v-model="form.${v.name}" type="datetime" />
26
- </dd>
27
- <!--{else if(v.dataType.indexOf('tinyint') !== -1)}-->
28
- <dd>
29
- <control_switch v-model="form.${v.name}" />
30
- </dd>
31
- <!--{else if(v.dataType.indexOf('text') !== -1)}-->
32
- <dd>
33
- <control_textarea v-model="form.${v.name}" type="text" placeholder="${v.description.replace(/\([0-9A-Za-z_]+\)/g, '').replace('用于搜索', '').replace(/、/g, ' / ')}" />
34
- </dd>
35
- <!--{else if(v.type === 'number' && v.name.indexOf('id') === -1)}-->
36
- <dd>
37
- <control_number v-model="form.${v.name}" :min="0" :max="${v.number ? v.number.max : 0}" />
38
- </dd>
39
- <!--{else}-->
40
- <dd>
41
- <control_input v-model="form.${v.name}" :minlength="0" :maxlength="${v.string ? v.string.max : 0}" placeholder="${v.description.replace(/\([0-9A-Za-z_]+\)/g, '').replace('用于搜索', '').replace(/、/g, ' / ')}" />
42
- </dd>
43
- <!--{/if}-->
44
- <!--{/if}-->
45
- <!--{/loop}-->
46
- </dl>
47
- <footer>
48
- <div class="mm_group">
49
- <button class="mm_btn btn_default" type="button" @click="cancel">返回</button>
50
- <button class="mm_btn btn-primary" type="button" @click="submit()">提交</button>
51
- </div>
52
- </footer>
53
- </mm_form>
54
- </mm_col>
55
- </mm_grid>
56
- </main>
57
- </template>
58
-
59
-
60
- <script>
61
- import mixin from '/src/mixins/page.js';
62
-
63
- export default {
64
- mixins: [mixin],
65
- components: {},
66
- data() {
67
- return {
68
- url_submit: "${api.path}?",
69
- url_get_obj: "${api.path}?method=get_obj",
70
- field: "${sql.key}",
71
- query: {
72
- "${sql.key}": 0
73
- },
74
- form: {
75
- /*[loop field v idx]*/
76
- /*[if v.type === 'number']*/
77
- "${v.name}": 0,
78
- /*[else]*/
79
- "${v.name}": '',
80
- /*[/if]*/
81
- /*[/loop]*/
82
- },
83
- /*[loop js.data v idx]*/
84
- // ${' ' + v.title}
85
- '${v.name}': [/*[loop v.value a idx]*//*[if idx == 0]*/'${a}'/*[else]*/,'${a}'/*[/if]*//*[/loop]*/],
86
- /*[/loop]*/
87
- }
88
- },
89
- methods: {
90
- /*[loop js.data v idx]*/
91
- /*[if(v.path)]*/
92
- /**
93
- * 获取 ${v.title}
94
- * @param {query} 查询条件
95
- */
96
- get_/*[v.basename]*/(query){
97
- var _this = this;
98
- if(!query){
99
- query = {
100
- field: "${v.id},${v.field}"
101
- };
102
- }
103
- this.$get('~${v.path}', query, function(json) {
104
- if (json.result) {
105
- _this/*['.' + v.name]*/.clear();
106
- _this/*['.' + v.name]*/.addList(json.result.list)
107
- }
108
- });
109
- },
110
- /*[/if]*/
111
- /*[/loop]*/
112
- },
113
- created() {
114
- /*[loop js.data v idx]*/
115
- /*[if(v.path)]*/
116
- // 获取 ${v.title}
117
- this.get_/*[v.basename]*/();
118
- /*[/if]*/
119
- /*[/loop]*/
120
- }
121
- }
122
- </script>
123
-
124
- <style>
125
- </style>