mm_os 2.8.7 → 2.8.8

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.
@@ -1,71 +1,85 @@
1
1
  <template>
2
2
  <main id="${id}">
3
- <mm_warp>
4
- <mm_container>
5
- <mm_row>
6
- <mm_col class="col-12">
7
- <mm_card>
8
- <div class="card_head arrow">
3
+ <div class="mm_warp">
4
+ <div class="mm_container">
5
+ <div class="mm_row">
6
+ <div class="mm_col col-12">
7
+ <div class="mm_card" :class="{ 'hide_filter': !show_filter }">
8
+ <div class="card_head arrow" @click="show_filter = !show_filter">
9
9
  <h5>${api.title}</h5>
10
10
  </div>
11
11
  <div class="card_body">
12
- <mm_form class="bar_filter">
12
+ <div class="mm_form" class="bar_filter">
13
13
  <div class="title">
14
14
  <h5><span>筛选条件</span></h5>
15
15
  </div>
16
- <mm_list :col="3">
17
- <!--{if(param.list)}-->
16
+ <div class="mm_list list-3">
18
17
  <!--{loop param.list v idx}-->
19
- <!--{if(v.name == 'keyword')}-->
20
- <mm_item>
18
+ <!--{if(v.name === 'keyword')}-->
19
+ <div class="mm_item">
21
20
  <control_input v-model="query.keyword" title="${v.title}" desc="${v.description.replace(/\([0-9A-Za-z_]+\)/g, '').replace('用于搜索', '').replace(/、/g, ' / ')}"
22
- @blur="search()" />
23
- </mm_item>
21
+ />
22
+ </div>
24
23
  <!--{/if}-->
25
24
  <!--{/loop}-->
26
- <!--{/if}-->
27
25
  <!--{loop field v idx}-->
28
- <!--{if(v.format)}-->
26
+ <!--{if(v.show.search)}-->
27
+ <!--{if(v.show.search === "input")}-->
28
+ <div class="mm_item">
29
+ <control_input v-model="query.${v.name}" title="${v.title}" @blur="search()" />
30
+ </div>
31
+ <!--{else if(v.show.search === "select")}-->
29
32
  <!--{if(v.format.table)}-->
30
- <mm_item>
33
+ <div class="mm_item">
34
+ <!--{if(v.format.key.endWith('_id') !== -1)}-->
35
+ <control_select type="list" 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()" />
36
+ <!--{else}-->
31
37
  <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}')"
32
38
  @change="search()" />
33
- </mm_item>
39
+ <!--{/if}-->
40
+ </div>
41
+ <!--{else if(v.format.key.indexOf('user_id') !== -1)}-->
42
+ <div class="mm_item">
43
+ <control_select v-model="query.${v.format.key}" title="${v.title}" :options="$to_kv(${v.label})" @change="search()" />
44
+ </div>
34
45
  <!--{else}-->
35
- <mm_item>
46
+ <div class="mm_item">
36
47
  <control_select v-model="query.${v.format.key}" title="${v.title}" :options="$to_kv(${v.label})" @change="search()" />
37
- </mm_item>
48
+ </div>
49
+ <!--{/if}-->
38
50
  <!--{/if}-->
39
51
  <!--{/if}-->
40
52
  <!--{/loop}-->
41
- <mm_item>
42
- <mm_btn class="btn_primary-x" type="reset" @click.native="reset();search()">重置</mm_btn>
43
- </mm_item>
44
- </mm_list>
45
- </mm_form>
53
+ <div class="mm_item">
54
+ <button class="btn_primary-x" type="reset" @click.native="reset();">重置</button>
55
+ </div>
56
+ </div>
57
+ </div>
46
58
  <div class="bar_action">
47
59
  <h5><span>操作</span></h5>
48
60
  <div class="btns">
49
- <mm_btn class="btn_primary-x" url="./${name}_form?">添加</mm_btn>
50
- <mm_btn @click.native="show = true" class="btn_primary-x" v-bind:class="{ 'disabled': !selects }">批量修改</mm_btn>
61
+ <button class="btn_primary-x" url="./${name}_form?">添加</button>
62
+ <button @click.native="show = true" class="btn_primary-x" v-bind:class="{ 'disabled': !selects }">批量修改</button>
51
63
  </div>
52
64
  <div class="btn_small">
53
65
  <control_file class="btn_default-x" type="excel" :func="import_db" v-if="url_import"></control_file>
54
- <mm_btn class="btn_default-x" @click.native="export_db()" v-if="url_export">导出</mm_btn>
66
+ <button class="btn_default-x" @click.native="export_db()" v-if="url_export">导出</button>
55
67
  </div>
56
68
  </div>
57
- <mm_table type="3">
69
+ <div class="mm_table table-3">
58
70
  <thead class="table-sm">
59
71
  <tr>
60
72
  <th class="th_open"></th>
61
73
  <th class="th_selected"><input type="checkbox" :checked="select_state" @click="select_all()" /></th>
62
74
  <th class="th_id"><span>#</span></th>
63
75
  <!--{loop field v idx}-->
76
+ <!--{if(v.show.table)}-->
64
77
  <!--{if(v.name !== sql.key)}-->
65
- <th>
66
- <control_reverse title="${v.title}" v-model="query.orderby" field="${v.name}" :func="search"></control_reverse>
78
+ <th class="th_${v.name}">
79
+ <span>${v.title}</span>
67
80
  </th>
68
81
  <!--{/if}-->
82
+ <!--{/if}-->
69
83
  <!--{/loop}-->
70
84
  <th class="th_handle"><span>操作</span></th>
71
85
  </tr>
@@ -79,6 +93,7 @@
79
93
  <th class="th_selected"><input type="checkbox" :checked="select_has(o[field])" @click="select_change(o[field])" /></th>
80
94
  <td>{{ o[field] }}</td>
81
95
  <!--{loop field v idx}-->
96
+ <!--{if(v.show.table)}-->
82
97
  <!--{if(v.name !== sql.key)}-->
83
98
  <td>
84
99
  <!--{if(v.dataType === 'tinyint')}-->
@@ -106,51 +121,75 @@
106
121
  <!--{/if}-->
107
122
  </td>
108
123
  <!--{/if}-->
124
+ <!--{/if}-->
109
125
  <!--{/loop}-->
110
126
  <td>
111
- <mm_btn class="btn_primary" :url="'./${name}_form?${sql.key}=' + o[field]">修改</mm_btn>
112
- <mm_btn class="btn_warning" @click.native="del_show(o, field)">删除</mm_btn>
127
+ <button class="btn_primary" :url="'./${name}_form?${sql.key}=' + o[field]">修改</button>
128
+ <button class="btn_warning" @click.native="del_show(o, field)">删除</button>
113
129
  </td>
114
130
  </tr>
115
131
  </tbody>
116
132
  <!-- </draggable> -->
117
- </mm_table>
133
+
134
+ <template v-slot:right>
135
+ <thead class="table-sm">
136
+ <tr>
137
+ <th class="th_handle"><span>操作</span></th>
138
+ </tr>
139
+ </thead>
140
+ <tbody>
141
+ <tr v-for="(o, idx) in list_new" :key="idx" :class="{'active': select == idx, sub: o[father_id], open: opens_has(o[field]), no_sub: !opens_has_sub(o[field]) }"
142
+ @click="selected(idx)">
143
+ <td>
144
+ <button class="mm_btn btn_primary" :url="'./${name}_form?${sql.key}=' + o[field]">修改</button>
145
+ <button class="mm_btn btn_warning" @click.native="del_show(o, field)">删除</button>
146
+ </td>
147
+ </tr>
148
+ </tbody>
149
+ </template>
150
+ </div>
118
151
  </div>
119
- </mm_card>
120
- </mm_col>
121
- </mm_row>
122
- </mm_container>
123
- </mm_warp>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ </div>
124
157
  <mm_modal v-model="show" mask="true">
125
- <mm_card class="card">
158
+ <div class="mm_card" class="card">
126
159
  <div class="card_head">
127
160
  <h5>批量修改</h5>
128
161
  </div>
129
162
  <div class="card_body pa">
130
163
  <dl>
131
164
  <!--{loop field v idx}-->
132
- <!--{if(v.format)}-->
165
+ <!--{if(v.show.batch)}-->
133
166
  <dt>${v.title}</dt>
134
- <!--{if(v.format.table)}-->
135
- <dd>
136
- <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
137
- </dd>
138
- <!--{else}-->
139
167
  <dd>
168
+ <!--{if(v.show.batch === "input")}-->
169
+ <control_input v-model="form.${v.name}" />
170
+ <!--{else if(v.show.batch === "select")}-->
171
+ <!--{if(v.format.table)}-->
172
+ <!--{if(v.format.key.endWith('_id') !== -1)}-->
173
+ <control_select type="list" v-model="form.${v.format.key}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
174
+ <!--{else}-->
175
+ <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label}, '${v.format.id || v.format.key}', '${v.format.name}')" />
176
+ <!--{/if}-->
177
+ <!--{else}-->
140
178
  <control_select v-model="form.${v.format.key}" :options="$to_kv(${v.label})" />
141
- </dd>
179
+ <!--{/if}-->
142
180
  <!--{/if}-->
181
+ </dd>
143
182
  <!--{/if}-->
144
183
  <!--{/loop}-->
145
184
  </dl>
146
185
  </div>
147
186
  <div class="card_foot">
148
187
  <div class="mm_group">
149
- <button class="btn_default" type="reset" @click="show = false">取消</button>
150
- <button class="btn_primary" type="button" @click="batchSet()">提交</button>
188
+ <button class="mm_btn btn_default" type="reset" @click="show = false">取消</button>
189
+ <button class="mm_btn btn_primary" type="button" @click="batchSet()">提交</button>
151
190
  </div>
152
191
  </div>
153
- </mm_card>
192
+ </div>
154
193
  </mm_modal>
155
194
  </main>
156
195
  </template>
@@ -174,20 +213,12 @@
174
213
  },
175
214
  // 查询条件
176
215
  query: {
177
- //页码
178
- page: 0,
179
- //页面大小
180
- size: '0',
181
- /*[loop js.query v idx]*/
182
- // ${' ' + v.title}
183
- /*[if v.type === 'number' && !v.select]*/
184
- '${v.name}': 0,
185
- /*[else]*/
186
- '${v.name}': '',
187
- /*[/if]*/
188
- /*[/loop]*/
189
216
  //排序
190
- orderby: ""
217
+ orderby: "",
218
+ // 上级分类ID
219
+ father_id: '',
220
+ // 关键词
221
+ keyword: ''
191
222
  },
192
223
  form: {},
193
224
  //颜色
@@ -216,13 +247,22 @@
216
247
  }
217
248
  this.$get('~${v.path}', query, function(json) {
218
249
  if (json.result) {
219
- _this /*['.' + v.name]*/ .clear();
220
- _this /*['.' + v.name]*/ .addList(json.result.list)
250
+ _this/*['.' + v.name]*/.clear();
251
+ _this/*['.' + v.name]*/.addList(json.result.list)
221
252
  }
222
253
  });
223
254
  },
224
255
  /*[/if]*/
225
256
  /*[/loop]*/
257
+ /**
258
+ * 获取列表之前
259
+ * @param {Object} param 参数
260
+ */
261
+ get_list_before(param){
262
+ delete param.page;
263
+ param.size = "0";
264
+ return param;
265
+ }
226
266
  },
227
267
  created() {
228
268
  /*[loop js.data v idx]*/
@@ -234,16 +274,36 @@
234
274
  },
235
275
  computed: {
236
276
  list_new() {
237
- var lt = this.list.toTree(this.field).toList();
238
277
  var list = [];
239
- var arr = this.opens;
240
- for (var i = 0; i < lt.length; i++) {
241
- var o = lt[i];
242
- if (this.opens.indexOf(o[this.father_id]) !== -1) {
243
- list.push(o);
278
+ var {
279
+ keyword,
280
+ father_id
281
+ } = this.query;
282
+
283
+ if (keyword && father_id) {
284
+ return this.list.filter(function(o) {
285
+ return o.father_id == father_id && (o.title.indexOf(keyword) !== -1 || o.name.indexOf(
286
+ keyword) !== -1);
287
+ });
288
+ } else if (father_id) {
289
+ return this.list.filter(function(o) {
290
+ return o.father_id == father_id;
291
+ });
292
+ } else if (keyword) {
293
+ return this.list.filter(function(o) {
294
+ return o.title.indexOf(keyword) !== -1 || o.name.indexOf(keyword) !== -1;
295
+ });
296
+ } else {
297
+ var lt = this.list.toTree(this.field).toList();
298
+ var arr = this.opens;
299
+ for (var i = 0; i < lt.length; i++) {
300
+ var o = lt[i];
301
+ if (this.opens.indexOf(o[this.father_id]) !== -1) {
302
+ list.push(o);
303
+ }
244
304
  }
305
+ return list;
245
306
  }
246
- return list;
247
307
  }
248
308
  }
249
309
  }
@@ -143,8 +143,8 @@
143
143
  </mm_body>
144
144
  <footer>
145
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>
146
+ <button class="mm_btn btn_default" type="reset" @click="show = false">取消</button>
147
+ <button class="mm_btn btn_primary" type="button" @click="batchSet()">提交</button>
148
148
  </div>
149
149
  </footer>
150
150
  </mm_view>
@@ -58,8 +58,8 @@
58
58
  </dl>
59
59
  <footer>
60
60
  <div class="mm_group">
61
- <button class="btn_default" type="button" @click="cancel">返回</button>
62
- <button class="btn_primary" type="button" @click="submit()">提交</button>
61
+ <button class="mm_btn btn_default" type="button" @click="cancel">返回</button>
62
+ <button class="mm_btn btn_primary" type="button" @click="submit()">提交</button>
63
63
  </div>
64
64
  </footer>
65
65
  </mm_form>
@@ -46,8 +46,8 @@
46
46
  </dl>
47
47
  <footer>
48
48
  <div class="mm_group">
49
- <button class="btn_default" type="button" @click="cancel">返回</button>
50
- <button class="btn_primary" type="button" @click="submit()">提交</button>
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
51
  </div>
52
52
  </footer>
53
53
  </mm_form>
@@ -58,8 +58,8 @@
58
58
  </dl>
59
59
  <footer>
60
60
  <div class="mm_group">
61
- <button class="btn_default" type="button" @click="cancel">返回</button>
62
- <button class="btn_primary" type="button" @click="submit()">提交</button>
61
+ <button class="mm_btn btn_default" type="button" @click="cancel">返回</button>
62
+ <button class="mm_btn btn_primary" type="button" @click="submit()">提交</button>
63
63
  </div>
64
64
  </footer>
65
65
  </mm_form>
@@ -143,8 +143,8 @@
143
143
  </mm_body>
144
144
  <footer>
145
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>
146
+ <button class="mm_btn btn_default" type="reset" @click="show = false">取消</button>
147
+ <button class="mm_btn btn_primary" type="button" @click="batchSet()">提交</button>
148
148
  </div>
149
149
  </footer>
150
150
  </mm_view>
@@ -46,8 +46,8 @@
46
46
  </dl>
47
47
  <footer>
48
48
  <div class="mm_group">
49
- <button class="btn_default" type="button" @click="cancel">返回</button>
50
- <button class="btn_primary" type="button" @click="submit()">提交</button>
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
51
  </div>
52
52
  </footer>
53
53
  </mm_form>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.8.7",
3
+ "version": "2.8.8",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,21 +31,21 @@
31
31
  "license": "ISC",
32
32
  "dependencies": {
33
33
  "compressing": "^1.10.1",
34
- "koa": "^2.15.4",
34
+ "koa": "^2.16.0",
35
35
  "koa-body": "^6.0.1",
36
36
  "koa-compress": "^5.1.1",
37
37
  "koa-send": "^5.0.1",
38
38
  "koa-websocket": "^7.0.0",
39
39
  "mm_check": "^1.4.9",
40
- "mm_excel": "^1.2.0",
40
+ "mm_excel": "^1.2.1",
41
41
  "mm_expand": "^1.7.9",
42
42
  "mm_html": "^1.1.6",
43
43
  "mm_koa_proxy": "^1.0.0",
44
44
  "mm_logs": "^1.1.7",
45
- "mm_machine": "^1.9.0",
45
+ "mm_machine": "^1.9.1",
46
46
  "mm_mongodb": "^1.4.2",
47
47
  "mm_mqtt": "^1.0.6",
48
- "mm_mysql": "^1.8.9",
48
+ "mm_mysql": "^1.9.0",
49
49
  "mm_redis": "^1.4.2",
50
50
  "mm_ret": "^1.3.9",
51
51
  "mm_session": "^1.4.8",
@@ -53,7 +53,7 @@
53
53
  "mm_tpl": "^2.4.2",
54
54
  "mm_xml": "^1.1.6",
55
55
  "mosca": "^2.8.3",
56
- "mqtt": "^5.10.3",
56
+ "mqtt": "^5.10.4",
57
57
  "publish": "^0.6.0"
58
58
  }
59
59
  }