liujie
2023-10-31 1c08cdb19aa0531dc77665dbbde052133dff9ceb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8" />
    <title>amis demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link rel="stylesheet" href="${ctxPath}/sdk/sdk.css" />
    <link rel="stylesheet" href="${ctxPath}/sdk/helper.css" />
    <link rel="stylesheet" href="${ctxPath}/sdk/iconfont.css" />
    <!-- 这是默认主题所需的,如果是其他主题则不需要 -->
    <!-- 从 1.1.0 开始 sdk.css 将不支持 IE 11,如果要支持 IE11 请引用这个 css,并把前面那个删了 -->
    <!-- <link rel="stylesheet" href="sdk-ie11.css" /> -->
    <!-- 不过 amis 开发团队几乎没测试过 IE 11 下的效果,所以可能有细节功能用不了,如果发现请报 issue -->
    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="${ctxPath}/sdk/sdk.js"></script>
<script type="text/javascript">
    (function () {
        let amis = amisRequire('amis/embed');
        // 通过替换下面这个配置来生成不同页面
        let amisJSON = {
            "type": "page",
            "title": "",
            "regions": [
                "body",
                "toolbar",
                "header"
            ],
            "body": [
                {
                    "type": "crud",
                    "id": "u:e103c7434df8",
                    "syncLocation": false,
                    "api": {
                        "method": "post",
                        "url": "/operatorUser/listAll",
                        "messages": {
                        }
                    },
                    "columns": [
                        {
                            "label": "所在市",
                            "type": "text",
                            "name": "city",
                            "id": "u:71aded278293"
                        },
                        {
                            "label": "管理员姓名",
                            "type": "text",
                            "name": "adminName",
                            "id": "u:22cab5368b85",
                            "classNameExpr": "<%= data.courseName === '总计' ? 'bg-danger' : '' %>",
                            "placeholder": "-"
                        },
                        {
                            "label": "管理员手机号",
                            "type": "text",
                            "name": "adminPhone",
                            "id": "u:100d93c3a7af",
                            "classNameExpr": "<%= data.courseName === '总计' ? 'bg-danger' : '' %>",
                            "placeholder": "-"
                        },
                        {
                            "label": "认证平台",
                            "type": "mapping",
                            "name": "ptType",
                            "id": "u:0529135bd40c",
                            "placeholder": "-",
                            "map": {
                                "1": "支付宝",
                                "2": "微信"
                            }
                        },
                        {
                            "label": "认证类型",
                            "type": "mapping",
                            "name": "regisType",
                            "id": "u:89e54c565da1",
                            "placeholder": "-",
                            "map": {
                                "1": "法人",
                                "2": "个人"
                            }
                        },
                        {
                            "label": "分账比例",
                            "type": "text",
                            "name": "percent",
                            "id": "u:9f3c838b4dce",
                            "placeholder": "-",
                            "classNameExpr": "<%= data.courseName === '总计' ? 'bg-danger' : '' %>"
                        },
                        {
                            "type": "mapping",
                            "name": "isPass",
                            "label": "审核状态",
                            "id": "u:89e54c565da1",
                            "placeholder": "-",
                            "map": {
                                "1": "待审核",
                                "2": "审核中",
                                "3": "已通过",
                                "4": "已拒绝"
                            }
                        },
                        {
                            "type": "operation",
                            "id": "u:d69a8d60da29",
                            "buttons": [
                                {
                                    "type": "button",
                                    "label": "详情",
                                    "onEvent": {
                                        "click": {
                                            "actions": [
                                                {
                                                    "args": {
                                                        "options": {
                                                            "silent": false
                                                        },
                                                        "api": {
                                                            "url": "/ball/toRegister/$id",
                                                            "method": "get"
                                                        }
                                                    },
                                                    "actionType": "ajax"
                                                }
                                            ]
                                        }
                                    },
                                    "id": "u:ed2016be790a",
                                    "class": "link",
                                    "level": "link"
                                }
                            ]
                        }
                    ],
                    "bulkActions": [
                        {
                            "type": "button",
                            "level": "danger",
                            "label": "批量删除",
                            "actionType": "ajax",
                            "confirmText": "确定要删除?",
                            "api": "/xxx/batch-delete",
                            "id": "u:e179a3daeee8"
                        },
                        {
                            "type": "button",
                            "label": "批量编辑",
                            "actionType": "dialog",
                            "dialog": {
                                "title": "批量编辑",
                                "size": "md",
                                "body": {
                                    "type": "form",
                                    "api": "/xxx/bacth-edit",
                                    "body": [
                                        {
                                            "label": "字段1",
                                            "text": "字段1",
                                            "type": "input-text"
                                        }
                                    ]
                                }
                            },
                            "id": "u:4bbe1e5df5ed"
                        }
                    ],
                    "itemActions": [
                        {
                            "label": "分账比例",
                            "type": "button",
                            "id": "u:0120816fbcb0",
                            "level": "info",
                            "onEvent": {
                                "click": {
                                    "actions": [
                                        {
                                            "args": {
                                            },
                                            "dialog": {
                                                "type": "dialog",
                                                "title": "弹框标题",
                                                "body": [
                                                    {
                                                        "type": "form",
                                                        "title": "表单",
                                                        "body": [
                                                            {
                                                                "label": "测试分账id",
                                                                "type": "input-text",
                                                                "name": "id",
                                                                "id": "u:64ad701b83c3"
                                                            },
                                                            {
                                                                "label": "支付宝分账比例",
                                                                "type": "input-text",
                                                                "name": "ali",
                                                                "id": "u:91534896ba54"
                                                            },
                                                            {
                                                                "label": "微信分账比例",
                                                                "type": "input-text",
                                                                "name": "text",
                                                                "id": "u:4649d90555b1"
                                                            }
                                                        ],
                                                        "api": {
                                                            "url": "/ball/resSet",
                                                            "method": "get"
                                                        },
                                                        "id": "u:01f28ccf4fb8"
                                                    }
                                                ],
                                                "showCloseButton": true,
                                                "showErrorMsg": true,
                                                "showLoading": true,
                                                "id": "u:073191c211be"
                                            },
                                            "actionType": "dialog"
                                        }
                                    ],
                                    "weight": 0
                                }
                            }
                        }
                    ],
                    "filterSettingSource": [
                        "id",
                        "customerName",
                        "simName",
                        "address",
                        "industryId",
                        "email",
                        "createBy",
                        "updateBy",
                        "remark",
                        "customerCode"
                    ],
                    "features": [
                        "create",
                        "filter",
                        "bulkDelete",
                        "view",
                        "delete",
                        "update",
                        "bulkUpdate"
                    ],
                    "filterColumnCount": 3,
                    "filterEnabledList": [
                    ],
                    "headerToolbar": [
                        {
                            "label": "新增",
                            "type": "button",
                            "actionType": "dialog",
                            "level": "primary",
                            "dialog": {
                                "title": "新增",
                                "body": {
                                    "type": "form",
                                    "api": {
                                        "method": "post",
                                        "url": "/ball/getRegisterList",
                                        "messages": {
                                        }
                                    },
                                    "body": [
                                        {
                                            "type": "input-text",
                                            "name": "city",
                                            "label": "所在市"
                                        },
                                        {
                                            "type": "input-text",
                                            "name": "adminName",
                                            "label": "管理员姓名"
                                        },
                                        {
                                            "type": "input-text",
                                            "name": "adminPhone",
                                            "label": "管理员手机号"
                                        },
                                        {
                                            "type": "select",
                                            "name": "ptType",
                                            "label": "认证平台"
                                        },
                                        {
                                            "type": "select",
                                            "name": "regisType",
                                            "label": "认证类型"
                                        },
                                        {
                                            "type": "input-text",
                                            "name": "percent",
                                            "label": "分账比例"
                                        },
                                        {
                                            "type": "select",
                                            "name": "isPass",
                                            "label": "审核状态"
                                        },
                                        {
                                            "type": "input-operation"
                                        }
                                    ]
                                }
                            },
                            "id": "u:7ab8ef9ba27f"
                        },
                        "bulkActions"
                    ],
                    "filter": {
                        "title": "查询条件",
                        "columnCount": 3,
                        "mode": "horizontal",
                        "body": [
                            {
                                "type": "input-city",
                                "label": "城市选择",
                                "name": "cityCode",
                                "allowDistrict": false,
                                "id": "u:16db9fd9fe42",
                                "mode": "horizontal",
                                "horizontal": {
                                    "left": 3,
                                    "right": 9
                                },
                                "className": ""
                            },
                            {
                                "type": "input-date-range",
                                "label": "日期范围",
                                "name": "times",
                                "id": "u:5ea0ab341c9e",
                                "embed": false,
                                "format": "YYYY-MM-DD",
                                "inputFormat": "YYYY-MM-DD"
                            },
                            {
                                "type": "input-text",
                                "label": "管理员姓名",
                                "name": "adminName",
                                "id": "u:528726820775"
                            },
                            {
                                "type": "select",
                                "label": "认证平台",
                                "name": "ptType",
                                "options": [
                                    {
                                        "label": "全部",
                                        "value": ""
                                    },
                                    {
                                        "label": "支付宝",
                                        "value": "1"
                                    },
                                    {
                                        "label": "微信",
                                        "value": "2"
                                    }
                                ],
                                "id": "u:3f0a0a09ae17",
                                "multiple": false
                            },
                            {
                                "type": "select",
                                "label": "认证类型",
                                "name": "regisType",
                                "options": [
                                    {
                                        "label": "全部",
                                        "value": "全部"
                                    },
                                    {
                                        "label": "法人",
                                        "value": "1"
                                    },
                                    {
                                        "label": "个人",
                                        "value": "2"
                                    }
                                ],
                                "id": "u:62ad230ae3e4",
                                "multiple": false
                            },
                            {
                                "type": "select",
                                "label": "审核状态",
                                "name": "isPass",
                                "options": [
                                    {
                                        "label": "全部",
                                        "value": "全部"
                                    },
                                    {
                                        "label": "待审核",
                                        "value": "1"
                                    },
                                    {
                                        "label": "审核中",
                                        "value": "2"
                                    },
                                    {
                                        "label": "已通过",
                                        "value": "3"
                                    },
                                    {
                                        "label": "已拒绝",
                                        "value": "4"
                                    }
                                ],
                                "id": "u:b5833dda16af",
                                "multiple": false
                            }
                        ],
                        "id": "u:2c92f31a25d0",
                        "name": "select1",
                        "rules": [
                        ]
                    },
                    "perPageAvailable": [
                        10,
                        20,
                        50,
                        100
                    ],
                    "messages": {
                    },
                    "footerToolbar": [
                        {
                            "type": "statistics",
                            "align": "left"
                        },
                        {
                            "type": "pagination",
                            "align": "left"
                        },
                        {
                            "type": "switch-per-page",
                            "tpl": "内容",
                            "align": "left"
                        }
                    ],
                    "columnsTogglable": "auto",
                    "pageField": "",
                    "perPageField": "",
                    "alwaysShowPagination": true,
                    "loadDataOnce": true,
                    "perPage": 5,
                    "combineNum": 3
                }
            ],
            "id": "u:b14a93e2aeb3"
        };
 
        let amisScoped = amis.embed('#root', amisJSON);
 
 
    })();
 
    function test(){
        console.log("测试成功")
    }
 
    var myButton = document.getElementById("ttt");
    myButton.addEventListener("click",test);
</script>
 
</body>
</html>