@netang/quasar 0.2.30 → 0.2.32
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.
- package/.editorconfig +12 -12
- package/_docs/docs/components/field-table.md +58 -58
- package/_docs/docs/components/field-tree.md +21 -21
- package/_docs/docs/components/table.md +24 -24
- package/_docs/docs/utils/table.md +196 -196
- package/components/column-title/index.vue +38 -38
- package/components/data/index.vue +20 -20
- package/components/dialog/img-viewer/index.vue +697 -697
- package/components/dialog/index.vue +387 -387
- package/components/dragger/index.vue +203 -203
- package/components/drawer/index.vue +303 -303
- package/components/editor-code/index.vue +328 -328
- package/components/empty/index.vue +82 -82
- package/components/field-date/index.vue +860 -860
- package/components/field-date/methods.js +100 -100
- package/components/field-table/index.vue +1483 -1483
- package/components/field-text/index.vue +166 -166
- package/components/field-tree/index.vue +755 -755
- package/components/img/index.vue +279 -279
- package/components/input-number/index.vue +560 -560
- package/components/list-menu/index.vue +149 -149
- package/components/list-menu-item/index.vue +79 -79
- package/components/mixed-table/index.vue +532 -532
- package/components/mixed-table-splitter/index.vue +377 -377
- package/components/power-page/index.vue +96 -96
- package/components/price/index.vue +188 -188
- package/components/private/components/index.js +11 -11
- package/components/private/components/move-to-tree/index.vue +154 -154
- package/components/private/edit-power-data/index.vue +846 -846
- package/components/private/table-visible-columns-button/index.vue +114 -114
- package/components/render/index.vue +123 -123
- package/components/search/index.vue +231 -231
- package/components/search-item/index.vue +210 -210
- package/components/select/index.vue +177 -177
- package/components/splitter/index.vue +422 -422
- package/components/table/index.vue +513 -513
- package/components/table-column-fixed/index.vue +110 -110
- package/components/table-pagination/index.vue +192 -192
- package/components/table-summary/index.vue +107 -107
- package/components/thumbnail/index.vue +72 -72
- package/components/toolbar/index.vue +150 -150
- package/components/tree/index.vue +1728 -1728
- package/components/tree/virtual-scroll.vue +41 -41
- package/components/uploader/index.vue +196 -196
- package/components/uploader-query/index.vue +945 -945
- package/components/value-format/index.vue +274 -274
- package/components/virtual-scroll/index.vue +136 -136
- package/configs/area3.js +1 -1
- package/docs/404.html +33 -33
- package/docs/assets/404.html-60b35caa.js +1 -1
- package/docs/assets/404.html-d1e63d77.js +1 -1
- package/docs/assets/alert.html-b2a2a72f.js +5 -5
- package/docs/assets/alert.html-ba46d137.js +1 -1
- package/docs/assets/app-9f30aa4b.js +6 -6
- package/docs/assets/area.html-01b9b58d.js +42 -42
- package/docs/assets/area.html-9a4fce6a.js +1 -1
- package/docs/assets/arr.html-145d27e7.js +1 -1
- package/docs/assets/arr.html-674e65ab.js +11 -11
- package/docs/assets/auth.html-579fa830.js +1 -1
- package/docs/assets/auth.html-8544ed95.js +8 -8
- package/docs/assets/bus.html-c71254aa.js +1 -1
- package/docs/assets/bus.html-dc7d3d19.js +6 -6
- package/docs/assets/column-title.html-c735cb5a.js +3 -3
- package/docs/assets/column-title.html-e9316762.js +1 -1
- package/docs/assets/confirm.html-ddfdc27f.js +10 -10
- package/docs/assets/confirm.html-ef3e2bef.js +1 -1
- package/docs/assets/copy.html-d20345b6.js +1 -1
- package/docs/assets/copy.html-ef8c8571.js +13 -13
- package/docs/assets/data.html-6432175d.js +30 -30
- package/docs/assets/data.html-a3b05d5b.js +1 -1
- package/docs/assets/dialog.html-1f698e5a.js +1 -1
- package/docs/assets/dialog.html-62902b83.js +68 -68
- package/docs/assets/dialog.html-baea77c9.js +1 -1
- package/docs/assets/dialog.html-bb082fc4.js +1 -1
- package/docs/assets/dict.html-1311da3d.js +23 -23
- package/docs/assets/dict.html-b96fbf0c.js +1 -1
- package/docs/assets/dictOptions.html-7c4f40a5.js +1 -1
- package/docs/assets/dictOptions.html-fb99d175.js +5 -5
- package/docs/assets/dragger.html-668d3efa.js +1 -1
- package/docs/assets/dragger.html-749d585a.js +1 -1
- package/docs/assets/editor-code.html-6ab26ea9.js +1 -1
- package/docs/assets/editor-code.html-d196205d.js +1 -1
- package/docs/assets/empty.html-1c139131.js +1 -1
- package/docs/assets/empty.html-1e9c441d.js +1 -1
- package/docs/assets/field-date.html-069fdb13.js +1 -1
- package/docs/assets/field-date.html-ad204aa9.js +1 -1
- package/docs/assets/field-table.html-ce480f03.js +1 -1
- package/docs/assets/field-table.html-d9236160.js +1 -1
- package/docs/assets/field-text.html-7277c62f.js +1 -1
- package/docs/assets/field-text.html-ccb4cecf.js +1 -1
- package/docs/assets/field-tree.html-519bfb45.js +1 -1
- package/docs/assets/field-tree.html-fdc748d6.js +1 -1
- package/docs/assets/form.html-2b562c37.js +2 -2
- package/docs/assets/form.html-75104cd5.js +1 -1
- package/docs/assets/framework-204010b2.js +5 -5
- package/docs/assets/getData.html-990e3787.js +1 -1
- package/docs/assets/getData.html-bb72025f.js +34 -34
- package/docs/assets/getFile.html-42368004.js +1 -1
- package/docs/assets/getFile.html-99abd054.js +3 -3
- package/docs/assets/getImage.html-3429c5a1.js +1 -1
- package/docs/assets/getImage.html-4d886d83.js +3 -3
- package/docs/assets/getTime.html-7435f922.js +1 -1
- package/docs/assets/getTime.html-b37f49eb.js +20 -20
- package/docs/assets/img.html-7d1da657.js +1 -1
- package/docs/assets/img.html-fbea1105.js +1 -1
- package/docs/assets/index.html-1695dd7c.js +1 -1
- package/docs/assets/index.html-65a4aa67.js +1 -1
- package/docs/assets/index.html-7b98d5bd.js +1 -1
- package/docs/assets/index.html-c01f2648.js +1 -1
- package/docs/assets/input-number.html-0b250d2a.js +1 -1
- package/docs/assets/input-number.html-a8eb0378.js +1 -1
- package/docs/assets/list-menu-item.html-7f1b4611.js +1 -1
- package/docs/assets/list-menu-item.html-84ed5ab8.js +1 -1
- package/docs/assets/list-menu.html-28b4163f.js +1 -1
- package/docs/assets/list-menu.html-cb6ba95b.js +1 -1
- package/docs/assets/loading.html-dae9e39d.js +6 -6
- package/docs/assets/loading.html-dc74c9e6.js +1 -1
- package/docs/assets/notify.html-e6c4c514.js +1 -1
- package/docs/assets/notify.html-f2c4d914.js +8 -8
- package/docs/assets/power-page.html-32e02f82.js +1 -1
- package/docs/assets/power-page.html-485e77da.js +1 -1
- package/docs/assets/power.html-d258cc19.js +93 -93
- package/docs/assets/power.html-e490bd32.js +1 -1
- package/docs/assets/previewImage.html-6a6b4245.js +1 -1
- package/docs/assets/previewImage.html-c5b7e945.js +2 -2
- package/docs/assets/price.html-1882c548.js +19 -19
- package/docs/assets/price.html-94d3f5be.js +1 -1
- package/docs/assets/price.html-d213df0f.js +1 -1
- package/docs/assets/price.html-deaf880f.js +1 -1
- package/docs/assets/render.html-8efcbdd4.js +1 -1
- package/docs/assets/render.html-df228e38.js +1 -1
- package/docs/assets/rule.html-2cd57fc2.js +13 -13
- package/docs/assets/rule.html-61662001.js +1 -1
- package/docs/assets/ruleValid.html-04fe2552.js +1 -1
- package/docs/assets/ruleValid.html-e0a776af.js +14 -14
- package/docs/assets/search-0782d0d1.svg +1 -1
- package/docs/assets/search-item.html-3f75394c.js +1 -1
- package/docs/assets/search-item.html-4e942ecd.js +1 -1
- package/docs/assets/search.html-2807043e.js +1 -1
- package/docs/assets/search.html-c24f8806.js +1 -1
- package/docs/assets/select.html-00d0607c.js +1 -1
- package/docs/assets/select.html-de7731f5.js +1 -1
- package/docs/assets/splitter.html-56f51a70.js +1 -1
- package/docs/assets/splitter.html-f5c836d7.js +1 -1
- package/docs/assets/style-161e43ab.css +1 -1
- package/docs/assets/symbols.html-a6aea4bf.js +1 -1
- package/docs/assets/symbols.html-b1f65bad.js +21 -21
- package/docs/assets/table-column-fixed.html-3a69e7b2.js +1 -1
- package/docs/assets/table-column-fixed.html-e763c38b.js +1 -1
- package/docs/assets/table-pagination.html-236934d3.js +1 -1
- package/docs/assets/table-pagination.html-c37ee2ac.js +1 -1
- package/docs/assets/table-splitter.html-07eab15c.js +1 -1
- package/docs/assets/table-splitter.html-7670ee65.js +1 -1
- package/docs/assets/table-summary.html-04db434f.js +1 -1
- package/docs/assets/table-summary.html-943c65a0.js +1 -1
- package/docs/assets/table.html-36253ad7.js +1 -1
- package/docs/assets/table.html-7f9c5d1b.js +38 -38
- package/docs/assets/table.html-93d53dc8.js +1 -1
- package/docs/assets/table.html-ac99b9cb.js +1 -1
- package/docs/assets/thumbnail.html-bab1976b.js +1 -1
- package/docs/assets/thumbnail.html-eb64e5e8.js +1 -1
- package/docs/assets/timestamp.html-4e54f79b.js +13 -13
- package/docs/assets/timestamp.html-d0e1b88a.js +1 -1
- package/docs/assets/toast.html-58ecbe21.js +1 -1
- package/docs/assets/toast.html-c9b9d36b.js +6 -6
- package/docs/assets/toolbar.html-83d9f97c.js +1 -1
- package/docs/assets/toolbar.html-ff7b8c92.js +1 -1
- package/docs/assets/tree.html-d07cbe79.js +23 -23
- package/docs/assets/tree.html-ea04193e.js +1 -1
- package/docs/assets/uploader-query.html-05590718.js +1 -1
- package/docs/assets/uploader-query.html-3175bac5.js +1 -1
- package/docs/assets/uploader.html-36da4394.js +2 -2
- package/docs/assets/uploader.html-6b5f3079.js +1 -1
- package/docs/assets/uploader.html-b9340b57.js +1 -1
- package/docs/assets/uploader.html-bc1c22e3.js +1 -1
- package/docs/assets/value-format.html-8ae3d47d.js +1 -1
- package/docs/assets/value-format.html-afa99b3d.js +1 -1
- package/docs/components/column-title.html +35 -35
- package/docs/components/data.html +62 -62
- package/docs/components/dialog.html +33 -33
- package/docs/components/dragger.html +33 -33
- package/docs/components/editor-code.html +33 -33
- package/docs/components/empty.html +33 -33
- package/docs/components/field-date.html +33 -33
- package/docs/components/field-table.html +33 -33
- package/docs/components/field-text.html +33 -33
- package/docs/components/field-tree.html +33 -33
- package/docs/components/img.html +33 -33
- package/docs/components/input-number.html +33 -33
- package/docs/components/list-menu-item.html +33 -33
- package/docs/components/list-menu.html +33 -33
- package/docs/components/power-page.html +33 -33
- package/docs/components/price.html +33 -33
- package/docs/components/render.html +33 -33
- package/docs/components/search-item.html +33 -33
- package/docs/components/search.html +33 -33
- package/docs/components/select.html +33 -33
- package/docs/components/splitter.html +33 -33
- package/docs/components/table-column-fixed.html +33 -33
- package/docs/components/table-pagination.html +33 -33
- package/docs/components/table-splitter.html +33 -33
- package/docs/components/table-summary.html +33 -33
- package/docs/components/table.html +33 -33
- package/docs/components/thumbnail.html +33 -33
- package/docs/components/toolbar.html +33 -33
- package/docs/components/uploader-query.html +33 -33
- package/docs/components/uploader.html +33 -33
- package/docs/components/value-format.html +33 -33
- package/docs/css/index.css +3 -3
- package/docs/index.html +33 -33
- package/docs/utils/alert.html +37 -37
- package/docs/utils/area.html +74 -74
- package/docs/utils/arr.html +43 -43
- package/docs/utils/auth.html +40 -40
- package/docs/utils/bus.html +38 -38
- package/docs/utils/confirm.html +42 -42
- package/docs/utils/copy.html +45 -45
- package/docs/utils/dialog.html +100 -100
- package/docs/utils/dict.html +55 -55
- package/docs/utils/dictOptions.html +37 -37
- package/docs/utils/form.html +34 -34
- package/docs/utils/getData.html +66 -66
- package/docs/utils/getFile.html +35 -35
- package/docs/utils/getImage.html +35 -35
- package/docs/utils/getTime.html +52 -52
- package/docs/utils/index.html +33 -33
- package/docs/utils/loading.html +38 -38
- package/docs/utils/notify.html +40 -40
- package/docs/utils/power.html +125 -125
- package/docs/utils/previewImage.html +34 -34
- package/docs/utils/price.html +51 -51
- package/docs/utils/rule.html +45 -45
- package/docs/utils/ruleValid.html +46 -46
- package/docs/utils/symbols.html +53 -53
- package/docs/utils/table.html +70 -70
- package/docs/utils/timestamp.html +45 -45
- package/docs/utils/toast.html +38 -38
- package/docs/utils/tree.html +55 -55
- package/docs/utils/uploader.html +34 -34
- package/package.json +25 -25
- package/sass/common.scss +184 -184
- package/sass/index.scss +12 -12
- package/sass/line.scss +39 -39
- package/sass/quasar/btn.scss +46 -46
- package/sass/quasar/common.scss +3 -3
- package/sass/quasar/drawer.scss +6 -6
- package/sass/quasar/field.scss +259 -259
- package/sass/quasar/loading.scss +6 -6
- package/sass/quasar/table.scss +168 -168
- package/sass/quasar/toolbar.scss +22 -22
- package/sass/variables.scss +140 -140
- package/store/index.js +29 -29
- package/utils/$auth.js +128 -128
- package/utils/$form.js +72 -72
- package/utils/$power.js +1494 -1492
- package/utils/$render.js +75 -75
- package/utils/$rule.js +13 -13
- package/utils/$ruleValid.js +10 -10
- package/utils/$search.js +416 -416
- package/utils/$table.js +1348 -1276
- package/utils/$tree.js +682 -682
- package/utils/alert.js +12 -12
- package/utils/area.js +400 -400
- package/utils/arr.js +51 -51
- package/utils/bus.js +6 -6
- package/utils/config.js +66 -66
- package/utils/confirm.js +11 -11
- package/utils/copy.js +30 -30
- package/utils/dialog.js +36 -36
- package/utils/dict.js +21 -21
- package/utils/dictOptions.js +28 -28
- package/utils/getData.js +88 -88
- package/utils/getFile.js +67 -67
- package/utils/getImage.js +276 -276
- package/utils/getTime.js +113 -113
- package/utils/index.js +67 -67
- package/utils/loading.js +15 -15
- package/utils/notify.js +13 -13
- package/utils/play.js +40 -40
- package/utils/previewImage.js +14 -14
- package/utils/price.js +18 -18
- package/utils/symbols.js +18 -18
- package/utils/timestamp.js +18 -18
- package/utils/toast.js +13 -13
- package/utils/uploader.js +2114 -2114
- package/utils/useAuth.js +30 -30
- package/utils/useFileUrl.js +26 -26
- package/utils/useRouter.js +47 -47
- package/utils/useSearch.js +562 -562
|
@@ -1,846 +1,846 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="col-xs-12 row q-col-gutter-lg">
|
|
3
|
-
|
|
4
|
-
<!-- 栏目标题 -->
|
|
5
|
-
<n-column-title label="数据配置" />
|
|
6
|
-
|
|
7
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
8
|
-
<slot/>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<template v-if="dataType">
|
|
12
|
-
|
|
13
|
-
<!-- 设置重定向 URL -->
|
|
14
|
-
<div class="col-xs-12 col-sm-6 col-md-3" v-if="! url">
|
|
15
|
-
|
|
16
|
-
<!-- 树 -->
|
|
17
|
-
<n-field-tree
|
|
18
|
-
class="n-field-fieldset"
|
|
19
|
-
:label="dataType === dicts.POWER_DATA_TYPE__OPEN ? '跳转页面' : '重定向 URL'"
|
|
20
|
-
outlined
|
|
21
|
-
clearable
|
|
22
|
-
stack-label
|
|
23
|
-
dense
|
|
24
|
-
|
|
25
|
-
v-model="formData.toPage"
|
|
26
|
-
:nodes="treeNodes"
|
|
27
|
-
:expanded="treeExpanded"
|
|
28
|
-
strict
|
|
29
|
-
accordion
|
|
30
|
-
/>
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<!-- 列表有效 -->
|
|
34
|
-
<template v-if="dataType === dicts.POWER_DATA_TYPE__LIST">
|
|
35
|
-
|
|
36
|
-
<!-- 列表选择类型 -->
|
|
37
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
38
|
-
<q-select
|
|
39
|
-
class="n-field-fieldset"
|
|
40
|
-
label="选择类型"
|
|
41
|
-
v-model="formData.selection"
|
|
42
|
-
:options="[
|
|
43
|
-
{ label: '无', value: 'none' },
|
|
44
|
-
{ label: '单选', value: 'single' },
|
|
45
|
-
{ label: '多选', value: 'multiple' },
|
|
46
|
-
]"
|
|
47
|
-
map-options
|
|
48
|
-
emit-value
|
|
49
|
-
outlined
|
|
50
|
-
stack-label
|
|
51
|
-
dense
|
|
52
|
-
options-dense
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<!-- 非列表有效 -->
|
|
59
|
-
<template v-else>
|
|
60
|
-
|
|
61
|
-
<!-- 新窗口有效 -->
|
|
62
|
-
<template v-if="dataType === dicts.POWER_DATA_TYPE__OPEN">
|
|
63
|
-
|
|
64
|
-
<!-- 是否记录来源页面 -->
|
|
65
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
66
|
-
<q-select
|
|
67
|
-
class="n-field-fieldset"
|
|
68
|
-
label="来源页面参数"
|
|
69
|
-
v-model="formData.noFromPageQuery"
|
|
70
|
-
:options="[
|
|
71
|
-
{ label: '自动添加', value: false },
|
|
72
|
-
{ label: '禁止添加', value: true },
|
|
73
|
-
]"
|
|
74
|
-
map-options
|
|
75
|
-
emit-value
|
|
76
|
-
outlined
|
|
77
|
-
stack-label
|
|
78
|
-
dense
|
|
79
|
-
options-dense
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
</template>
|
|
84
|
-
|
|
85
|
-
<!-- 非表单显示 -->
|
|
86
|
-
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
87
|
-
|
|
88
|
-
<!-- 显示类型 -->
|
|
89
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
90
|
-
<q-select
|
|
91
|
-
class="n-field-fieldset"
|
|
92
|
-
label="显示类型"
|
|
93
|
-
v-model="formData.show"
|
|
94
|
-
:options="[
|
|
95
|
-
{ label: '始终显示', value: '' },
|
|
96
|
-
{ label: '单选显示', value: 'single' },
|
|
97
|
-
{ label: '多选显示', value: 'multiple' },
|
|
98
|
-
]"
|
|
99
|
-
map-options
|
|
100
|
-
emit-value
|
|
101
|
-
outlined
|
|
102
|
-
stack-label
|
|
103
|
-
dense
|
|
104
|
-
options-dense
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<!-- 是否固定列 -->
|
|
109
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
110
|
-
<q-select
|
|
111
|
-
class="n-field-fieldset"
|
|
112
|
-
label="是否固定列"
|
|
113
|
-
v-model="formData.fixed"
|
|
114
|
-
:options="[
|
|
115
|
-
{ label: '否', value: false },
|
|
116
|
-
{ label: '是', value: true },
|
|
117
|
-
]"
|
|
118
|
-
map-options
|
|
119
|
-
emit-value
|
|
120
|
-
outlined
|
|
121
|
-
stack-label
|
|
122
|
-
dense
|
|
123
|
-
options-dense
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<!-- 是否双击 -->
|
|
128
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
129
|
-
<q-select
|
|
130
|
-
class="n-field-fieldset"
|
|
131
|
-
label="是否双击"
|
|
132
|
-
v-model="formData.dbclick"
|
|
133
|
-
:options="[
|
|
134
|
-
{ label: '否', value: false },
|
|
135
|
-
{ label: '是', value: true },
|
|
136
|
-
]"
|
|
137
|
-
map-options
|
|
138
|
-
emit-value
|
|
139
|
-
outlined
|
|
140
|
-
stack-label
|
|
141
|
-
dense
|
|
142
|
-
options-dense
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
</template>
|
|
146
|
-
|
|
147
|
-
<!-- 如果为非新窗口 -->
|
|
148
|
-
<template v-if="dataType !== dicts.POWER_DATA_TYPE__OPEN">
|
|
149
|
-
|
|
150
|
-
<!-- 是否表单验证 -->
|
|
151
|
-
<div class="col-xs-12 col-sm-6 col-md-3" v-if="dataType === dicts.POWER_DATA_TYPE__FORM">
|
|
152
|
-
<q-select
|
|
153
|
-
class="n-field-fieldset"
|
|
154
|
-
label="提交前验证表单"
|
|
155
|
-
v-model="formData.validate"
|
|
156
|
-
:options="[
|
|
157
|
-
{ label: '关闭表单验证', value: false },
|
|
158
|
-
{ label: '开启表单验证', value: true },
|
|
159
|
-
]"
|
|
160
|
-
map-options
|
|
161
|
-
emit-value
|
|
162
|
-
outlined
|
|
163
|
-
stack-label
|
|
164
|
-
dense
|
|
165
|
-
options-dense
|
|
166
|
-
/>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<!-- 是否确认 -->
|
|
170
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
171
|
-
<q-select
|
|
172
|
-
class="n-field-fieldset"
|
|
173
|
-
label="提交前确认"
|
|
174
|
-
v-model="formData.confirm"
|
|
175
|
-
:options="[
|
|
176
|
-
{ label: '否', value: 0 },
|
|
177
|
-
{ label: '提交前确认', value: 1 },
|
|
178
|
-
{ label: '提交前确认登录密码', value: 2 },
|
|
179
|
-
]"
|
|
180
|
-
map-options
|
|
181
|
-
emit-value
|
|
182
|
-
outlined
|
|
183
|
-
stack-label
|
|
184
|
-
dense
|
|
185
|
-
options-dense
|
|
186
|
-
/>
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
<!-- 确认提示内容 -->
|
|
190
|
-
<div class="col-xs-12 col-sm-6 col-md-3" v-if="formData.confirm > 0">
|
|
191
|
-
<q-input
|
|
192
|
-
class="n-field-fieldset"
|
|
193
|
-
label="确认提示内容"
|
|
194
|
-
v-model="formData.confirmContent"
|
|
195
|
-
:placeholder="formData.confirm === 1 ? '确认要执行该操作吗?' : '重要操作,请输入登录密码并确认后操作'"
|
|
196
|
-
outlined
|
|
197
|
-
clearable
|
|
198
|
-
stack-label
|
|
199
|
-
dense
|
|
200
|
-
/>
|
|
201
|
-
</div>
|
|
202
|
-
|
|
203
|
-
<!-- 请求成功执行 -->
|
|
204
|
-
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
205
|
-
<q-select
|
|
206
|
-
class="n-field-fieldset"
|
|
207
|
-
label="请求成功执行"
|
|
208
|
-
v-model="formData.requestSuccess.type"
|
|
209
|
-
:options="dataType === dicts.POWER_DATA_TYPE__FORM ?
|
|
210
|
-
[
|
|
211
|
-
{ label: '无', value: '' },
|
|
212
|
-
{ label: '关闭窗口', value: 'close' },
|
|
213
|
-
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
214
|
-
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
215
|
-
{ label: '重置表单', value: 'resetForm' },
|
|
216
|
-
] :
|
|
217
|
-
[
|
|
218
|
-
{ label: '无', value: '' },
|
|
219
|
-
{ label: '关闭窗口', value: 'close' },
|
|
220
|
-
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
221
|
-
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
222
|
-
{ label: '刷新列表', value: 'refreshList' },
|
|
223
|
-
]
|
|
224
|
-
"
|
|
225
|
-
map-options
|
|
226
|
-
emit-value
|
|
227
|
-
outlined
|
|
228
|
-
stack-label
|
|
229
|
-
dense
|
|
230
|
-
options-dense
|
|
231
|
-
/>
|
|
232
|
-
</div>
|
|
233
|
-
|
|
234
|
-
<!-- 请求成功参数 -->
|
|
235
|
-
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n_indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
236
|
-
|
|
237
|
-
<!-- <!– 树 –>-->
|
|
238
|
-
<!-- <n-field-tree-->
|
|
239
|
-
<!-- class="n-field-fieldset"-->
|
|
240
|
-
<!-- label="跳转页面"-->
|
|
241
|
-
<!-- outlined-->
|
|
242
|
-
<!-- clearable-->
|
|
243
|
-
<!-- stack-label-->
|
|
244
|
-
<!-- dense-->
|
|
245
|
-
|
|
246
|
-
<!-- v-model="formData.requestSuccess.params"-->
|
|
247
|
-
<!-- :nodes="treeNodes"-->
|
|
248
|
-
<!-- :expanded="treeExpanded"-->
|
|
249
|
-
<!-- strict-->
|
|
250
|
-
<!-- accordion-->
|
|
251
|
-
<!-- />-->
|
|
252
|
-
<!--</div>-->
|
|
253
|
-
|
|
254
|
-
</template>
|
|
255
|
-
|
|
256
|
-
<!-- 如果为非表单 -->
|
|
257
|
-
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
258
|
-
|
|
259
|
-
<!-- 栏目标题 -->
|
|
260
|
-
<n-column-title label="请求列表参数" tooltip='示例:id / sku_id AS sku' />
|
|
261
|
-
|
|
262
|
-
<!-- 表格请求参数 -->
|
|
263
|
-
<div class="col-xs-12">
|
|
264
|
-
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
265
|
-
<q-item
|
|
266
|
-
v-for="(item, itemIndex) in formData.requestQuery.list"
|
|
267
|
-
>
|
|
268
|
-
<q-item-section>
|
|
269
|
-
<q-input
|
|
270
|
-
class="n-field-fieldset"
|
|
271
|
-
v-model="formData.requestQuery.list[itemIndex]"
|
|
272
|
-
placeholder="请输入参数"
|
|
273
|
-
outlined
|
|
274
|
-
clearable
|
|
275
|
-
stack-label
|
|
276
|
-
dense
|
|
277
|
-
/>
|
|
278
|
-
</q-item-section>
|
|
279
|
-
|
|
280
|
-
<q-item-section side>
|
|
281
|
-
<div class="text-grey-8 q-gutter-xs">
|
|
282
|
-
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.list, itemIndex, '')" />
|
|
283
|
-
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
284
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
285
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.list, itemIndex)" :disable="formData.requestQuery.list.length <= itemIndex + 1" />
|
|
286
|
-
</div>
|
|
287
|
-
</q-item-section>
|
|
288
|
-
</q-item>
|
|
289
|
-
</q-list>
|
|
290
|
-
</div>
|
|
291
|
-
</template>
|
|
292
|
-
|
|
293
|
-
<!-- 栏目标题 -->
|
|
294
|
-
<n-column-title label="请求传参参数" tooltip='示例:id / sku_id AS sku / { "type": 1, "name": "age" }' />
|
|
295
|
-
|
|
296
|
-
<!-- 表格请求参数 -->
|
|
297
|
-
<div class="col-xs-12">
|
|
298
|
-
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
299
|
-
<q-item
|
|
300
|
-
v-for="(item, itemIndex) in formData.requestQuery.query"
|
|
301
|
-
>
|
|
302
|
-
<q-item-section>
|
|
303
|
-
<q-input
|
|
304
|
-
class="n-field-fieldset"
|
|
305
|
-
v-model="formData.requestQuery.query[itemIndex]"
|
|
306
|
-
placeholder="请输入参数"
|
|
307
|
-
outlined
|
|
308
|
-
clearable
|
|
309
|
-
stack-label
|
|
310
|
-
dense
|
|
311
|
-
/>
|
|
312
|
-
</q-item-section>
|
|
313
|
-
|
|
314
|
-
<q-item-section side>
|
|
315
|
-
<div class="text-grey-8 q-gutter-xs">
|
|
316
|
-
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
317
|
-
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
318
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
319
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
320
|
-
</div>
|
|
321
|
-
</q-item-section>
|
|
322
|
-
</q-item>
|
|
323
|
-
</q-list>
|
|
324
|
-
</div>
|
|
325
|
-
</template>
|
|
326
|
-
|
|
327
|
-
<!-- 栏目标题 -->
|
|
328
|
-
<n-column-title label="自定义参数" tooltip='示例:123 / id / [1, 2, 3] / { "type": 1, "name": "age" }' />
|
|
329
|
-
|
|
330
|
-
<!-- 自定义参数 -->
|
|
331
|
-
<div class="col-xs-12">
|
|
332
|
-
<q-input
|
|
333
|
-
style="max-width:800px"
|
|
334
|
-
class="n-field-fieldset"
|
|
335
|
-
v-model="formData.params"
|
|
336
|
-
placeholder="请输入参数"
|
|
337
|
-
outlined
|
|
338
|
-
clearable
|
|
339
|
-
stack-label
|
|
340
|
-
dense
|
|
341
|
-
autogrow
|
|
342
|
-
/>
|
|
343
|
-
</div>
|
|
344
|
-
</template>
|
|
345
|
-
</div>
|
|
346
|
-
</template>
|
|
347
|
-
|
|
348
|
-
<script>
|
|
349
|
-
import { ref, watch } from 'vue'
|
|
350
|
-
|
|
351
|
-
import NColumnTitle from '../../column-title'
|
|
352
|
-
import NFieldTree from '../../field-tree'
|
|
353
|
-
|
|
354
|
-
import $n_has from 'lodash/has'
|
|
355
|
-
import $n_isPlainObject from 'lodash/isPlainObject'
|
|
356
|
-
|
|
357
|
-
import $n_forEach from '@netang/utils/forEach'
|
|
358
|
-
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
359
|
-
import $n_indexOf from '@netang/utils/indexOf'
|
|
360
|
-
|
|
361
|
-
import $n_isRequired from '@netang/utils/isRequired'
|
|
362
|
-
import $n_forIn from '@netang/utils/forIn'
|
|
363
|
-
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
364
|
-
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
365
|
-
import $n_trimString from '@netang/utils/trimString'
|
|
366
|
-
import $n_isJson from '@netang/utils/isJson'
|
|
367
|
-
import $n_json from '@netang/utils/json'
|
|
368
|
-
import $n_isValidString from '@netang/utils/isValidString'
|
|
369
|
-
|
|
370
|
-
import $n_arr from '../../../utils/arr'
|
|
371
|
-
import $n_toast from '../../../utils/toast'
|
|
372
|
-
|
|
373
|
-
import { configs } from '../../../utils/config'
|
|
374
|
-
|
|
375
|
-
const {
|
|
376
|
-
// 字典常量
|
|
377
|
-
dicts,
|
|
378
|
-
} = configs
|
|
379
|
-
|
|
380
|
-
export default {
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* 声明属性
|
|
384
|
-
*/
|
|
385
|
-
props: {
|
|
386
|
-
// 值
|
|
387
|
-
modelValue: String,
|
|
388
|
-
// URL
|
|
389
|
-
url: String,
|
|
390
|
-
// 数据类型
|
|
391
|
-
dataType: Number,
|
|
392
|
-
// 路由类型
|
|
393
|
-
routeType: Number,
|
|
394
|
-
// 树节点数组
|
|
395
|
-
treeNodes: Array,
|
|
396
|
-
// 树展开节点
|
|
397
|
-
treeExpanded: Array,
|
|
398
|
-
},
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* 组件
|
|
402
|
-
*/
|
|
403
|
-
components: {
|
|
404
|
-
NColumnTitle,
|
|
405
|
-
NFieldTree,
|
|
406
|
-
},
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* 组合式
|
|
410
|
-
*/
|
|
411
|
-
setup(props) {
|
|
412
|
-
|
|
413
|
-
// ==========【数据】=============================================================================================
|
|
414
|
-
|
|
415
|
-
// 表单数据
|
|
416
|
-
const formData = ref(formatModelValue())
|
|
417
|
-
|
|
418
|
-
// ==========【监听数据】=========================================================================================
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* 监听值
|
|
422
|
-
*/
|
|
423
|
-
watch(()=>props.modelValue, function() {
|
|
424
|
-
|
|
425
|
-
// 格式化传值
|
|
426
|
-
formData.value = formatModelValue()
|
|
427
|
-
})
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* 监听数据类型
|
|
431
|
-
*/
|
|
432
|
-
watch(()=>props.dataType, function (val) {
|
|
433
|
-
|
|
434
|
-
// 如果数据类型为新窗口
|
|
435
|
-
if (val === dicts.POWER_DATA_TYPE__FORM) {
|
|
436
|
-
if (formData.value.requestSuccess.type === 'refreshList') {
|
|
437
|
-
formData.value.requestSuccess.type = ''
|
|
438
|
-
formData.value.requestSuccess.params = ''
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// 如果数据类型为数据
|
|
442
|
-
} else if (val === dicts.POWER_DATA_TYPE__DATA) {
|
|
443
|
-
if (formData.value.requestSuccess.type === 'resetForm') {
|
|
444
|
-
formData.value.requestSuccess.type = ''
|
|
445
|
-
formData.value.requestSuccess.params = ''
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
})
|
|
449
|
-
|
|
450
|
-
// ==========【方法】============================================================================================
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* 格式化传值
|
|
454
|
-
*/
|
|
455
|
-
function formatModelValue() {
|
|
456
|
-
|
|
457
|
-
let obj = {}
|
|
458
|
-
|
|
459
|
-
if ($n_isJson(props.modelValue)) {
|
|
460
|
-
const data = $n_json.parse(props.modelValue)
|
|
461
|
-
if ($n_isValidObject(data)) {
|
|
462
|
-
obj = data
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// 原始数据默认值
|
|
467
|
-
const rawObj = {
|
|
468
|
-
// 列表选择类型, 可选值 none single(默认) multiple
|
|
469
|
-
selection: '',
|
|
470
|
-
// 显示类型, 可选 single / multiple / 空(默认显示)
|
|
471
|
-
show: '',
|
|
472
|
-
// 禁止添加来源页面参数
|
|
473
|
-
noFromPageQuery: false,
|
|
474
|
-
// 页面 ID (跳转页面 / 重定向 URL)
|
|
475
|
-
toPage: '',
|
|
476
|
-
// 是否固定列
|
|
477
|
-
fixed: false,
|
|
478
|
-
// 是否双击: 可选 true / false
|
|
479
|
-
dbclick: false,
|
|
480
|
-
// 是否表单验证: 可选 true / false
|
|
481
|
-
validate: true,
|
|
482
|
-
// 是否确认: 可选 true / false / 字符串(确认提示的内容)
|
|
483
|
-
confirm: false,
|
|
484
|
-
// 是否确认密码: 可选 true / false / 字符串(确认提示的内容)
|
|
485
|
-
confirmPassword: false,
|
|
486
|
-
// 请求参数
|
|
487
|
-
requestQuery: {
|
|
488
|
-
// 列表: 字符串组成的数组, 如: [ "id", "sku_id AS sku" ]
|
|
489
|
-
list: [],
|
|
490
|
-
// 参数: 字符串 / 对象(自定义参数) 组成的数组, 如: [ "id", "sku_id AS sku", { "type": 1, "name": "age" } ]
|
|
491
|
-
query: null,
|
|
492
|
-
},
|
|
493
|
-
// 请求成功执行
|
|
494
|
-
requestSuccess: {
|
|
495
|
-
// 类型, 可选 close / closePush / closePushRefresh / resetForm / refreshList / 空(不执行)
|
|
496
|
-
type: '',
|
|
497
|
-
// 参数
|
|
498
|
-
params: '',
|
|
499
|
-
},
|
|
500
|
-
// 自定义参数, 任意类型
|
|
501
|
-
params: '',
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// 【格式化数据】删除无效键值
|
|
505
|
-
// --------------------------------------------------
|
|
506
|
-
|
|
507
|
-
// 原始键值
|
|
508
|
-
const rawKeys = Object.keys(rawObj)
|
|
509
|
-
|
|
510
|
-
// 删除数据中的无效键值
|
|
511
|
-
$n_forIn(obj, function (item, key) {
|
|
512
|
-
// 如果键值不在原始键值中
|
|
513
|
-
if (rawKeys.indexOf(key) === -1) {
|
|
514
|
-
// 则删除
|
|
515
|
-
delete obj[key]
|
|
516
|
-
}
|
|
517
|
-
})
|
|
518
|
-
|
|
519
|
-
// 判断 requestSuccess 值是否合法
|
|
520
|
-
if ($n_has(obj, 'requestSuccess') && ! $n_isValidObject(obj.requestSuccess)) {
|
|
521
|
-
delete(obj.requestSuccess)
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// 判断 requestQuery 值是否合法
|
|
525
|
-
if ($n_has(obj, 'requestQuery') && ! $n_isValidObject(obj.requestQuery)) {
|
|
526
|
-
delete(obj.requestQuery)
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// --------------------------------------------------
|
|
530
|
-
|
|
531
|
-
// 合并原始数据
|
|
532
|
-
obj = Object.assign(rawObj, obj)
|
|
533
|
-
|
|
534
|
-
// 列表选择类型默认值为 single
|
|
535
|
-
if (! $n_isValidString(obj.selection)) {
|
|
536
|
-
obj.selection = 'single'
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// 【格式化是否确认参数】
|
|
540
|
-
// ------------------------------------------------------------
|
|
541
|
-
// 是否确认, 可选 0:无 / 1:提交前确认 / 2:提交前确认登录密码
|
|
542
|
-
let confirm = 0
|
|
543
|
-
// 确认提示内容
|
|
544
|
-
obj.confirmContent = ''
|
|
545
|
-
if (obj.confirmPassword) {
|
|
546
|
-
confirm = 2
|
|
547
|
-
if ($n_isValidString(obj.confirmPassword)) {
|
|
548
|
-
obj.confirmContent = obj.confirmPassword
|
|
549
|
-
}
|
|
550
|
-
} else if (obj.confirm) {
|
|
551
|
-
confirm = 1
|
|
552
|
-
if ($n_isValidString(obj.confirm)) {
|
|
553
|
-
obj.confirmContent = obj.confirm
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
obj.confirm = confirm
|
|
557
|
-
delete obj.confirmPassword
|
|
558
|
-
|
|
559
|
-
// 【格式化请求参数中的 list】
|
|
560
|
-
// ------------------------------------------------------------
|
|
561
|
-
if ($n_isValidString(obj.requestQuery.list)) {
|
|
562
|
-
obj.requestQuery.list = [obj.requestQuery.list]
|
|
563
|
-
} else if (! $n_isValidArray(obj.requestQuery.list)) {
|
|
564
|
-
obj.requestQuery.list = ['']
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// 【格式化请求参数中的 query】
|
|
568
|
-
// ------------------------------------------------------------
|
|
569
|
-
if ($n_has(obj.requestQuery, 'query')) {
|
|
570
|
-
|
|
571
|
-
// 如果是有效值
|
|
572
|
-
if ($n_isValidValue(obj.requestQuery.query)) {
|
|
573
|
-
obj.requestQuery.query = [obj.requestQuery.query]
|
|
574
|
-
|
|
575
|
-
// 如果是有效对象
|
|
576
|
-
} else if ($n_isValidObject(obj.requestQuery.query)) {
|
|
577
|
-
obj.requestQuery.query = [$n_json.stringify(obj.requestQuery.query)]
|
|
578
|
-
|
|
579
|
-
// 如果是有效数组
|
|
580
|
-
} else if ($n_isValidArray(obj.requestQuery.query)) {
|
|
581
|
-
const query = []
|
|
582
|
-
$n_forEach(obj.requestQuery.query, function(item) {
|
|
583
|
-
|
|
584
|
-
// 如果是有效值
|
|
585
|
-
if ($n_isValidValue(item)) {
|
|
586
|
-
query.push(item)
|
|
587
|
-
|
|
588
|
-
// 如果是对象
|
|
589
|
-
} else if ($n_isValidObject(item)) {
|
|
590
|
-
query.push($n_json.stringify(item))
|
|
591
|
-
}
|
|
592
|
-
})
|
|
593
|
-
obj.requestQuery.query = query.length ? query : ['']
|
|
594
|
-
|
|
595
|
-
// 否则没有数据
|
|
596
|
-
} else {
|
|
597
|
-
obj.requestQuery.query = ['']
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// 否则没有数据
|
|
601
|
-
} else {
|
|
602
|
-
obj.requestQuery.query = ['']
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// 【格式化其他参数】
|
|
606
|
-
// ------------------------------------------------------------
|
|
607
|
-
if (! $n_has(obj, 'params')) {
|
|
608
|
-
obj.params = ''
|
|
609
|
-
|
|
610
|
-
// 如果不是字符串
|
|
611
|
-
} else if (! $n_isValidString(obj.params)) {
|
|
612
|
-
if ($n_isValidObject(obj.params)) {
|
|
613
|
-
obj.params = $n_json.stringify(obj.params)
|
|
614
|
-
} else if ($n_isValidArray(obj.params)) {
|
|
615
|
-
obj.params = $n_json.stringify(obj.params)
|
|
616
|
-
} else {
|
|
617
|
-
obj.params = ''
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
// ------------------------------------------------------------
|
|
621
|
-
|
|
622
|
-
return obj
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* 获取格式化后的表单数据
|
|
627
|
-
*/
|
|
628
|
-
function getValue() {
|
|
629
|
-
|
|
630
|
-
const obj = {}
|
|
631
|
-
|
|
632
|
-
// 获取表单数据
|
|
633
|
-
const data = formData.value
|
|
634
|
-
|
|
635
|
-
// 如果有选择数据类型
|
|
636
|
-
if (props.dataType) {
|
|
637
|
-
|
|
638
|
-
// 设置请求参数
|
|
639
|
-
function setRequestQuery(field) {
|
|
640
|
-
|
|
641
|
-
// 请求表格参数
|
|
642
|
-
const lists = []
|
|
643
|
-
|
|
644
|
-
$n_forEach(data.requestQuery[field], function(value) {
|
|
645
|
-
|
|
646
|
-
value = formatParams(value)
|
|
647
|
-
|
|
648
|
-
// 如果有值
|
|
649
|
-
if ($n_isRequired(value)) {
|
|
650
|
-
|
|
651
|
-
// 如果为表格
|
|
652
|
-
if (field === 'list') {
|
|
653
|
-
|
|
654
|
-
if (Array.isArray(value) || $n_isPlainObject(value)) {
|
|
655
|
-
|
|
656
|
-
// 轻提示
|
|
657
|
-
$n_toast({
|
|
658
|
-
message: '请求列表参数格式不能是数组或对象',
|
|
659
|
-
})
|
|
660
|
-
return false
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
// 否则为参数
|
|
664
|
-
} else if (Array.isArray(value)) {
|
|
665
|
-
// 轻提示
|
|
666
|
-
$n_toast({
|
|
667
|
-
message: '请求传参参数格式不能是数组',
|
|
668
|
-
})
|
|
669
|
-
return false
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// 如果是字符串
|
|
673
|
-
lists.push(value)
|
|
674
|
-
}
|
|
675
|
-
})
|
|
676
|
-
|
|
677
|
-
if (lists.length) {
|
|
678
|
-
if (! $n_has(obj, 'requestQuery')) {
|
|
679
|
-
obj.requestQuery = {}
|
|
680
|
-
}
|
|
681
|
-
obj.requestQuery[field] = lists.length === 1 ? lists[0] : lists
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
return true
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
// 格式化其他参数
|
|
688
|
-
function formatParams(value) {
|
|
689
|
-
value = $n_trimString(value)
|
|
690
|
-
if (
|
|
691
|
-
(value.startsWith('[') || value.startsWith('{'))
|
|
692
|
-
&& $n_isJson(value)
|
|
693
|
-
) {
|
|
694
|
-
value = $n_json.parse(value)
|
|
695
|
-
|
|
696
|
-
if (! Array.isArray(value) && ! $n_isPlainObject(value)) {
|
|
697
|
-
return ''
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
return value
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
// 如果列表显示
|
|
704
|
-
// --------------------------------------------------
|
|
705
|
-
if (props.dataType === dicts.POWER_DATA_TYPE__LIST) {
|
|
706
|
-
|
|
707
|
-
// 列表选择类型
|
|
708
|
-
if ($n_indexOf(['none', 'multiple'], data.selection) > -1) {
|
|
709
|
-
obj.selection = data.selection
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
} else {
|
|
713
|
-
|
|
714
|
-
// 如果表单显示
|
|
715
|
-
// --------------------------------------------------
|
|
716
|
-
if (props.dataType === dicts.POWER_DATA_TYPE__FORM) {
|
|
717
|
-
|
|
718
|
-
// 关闭表单验证(默认开启)
|
|
719
|
-
if (data.validate === false) {
|
|
720
|
-
obj.validate = false
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
// 如果非表单显示
|
|
724
|
-
} else {
|
|
725
|
-
|
|
726
|
-
// 显示类型
|
|
727
|
-
if (data.show) {
|
|
728
|
-
obj.show = data.show
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
// 是否固定列
|
|
732
|
-
if (data.fixed) {
|
|
733
|
-
obj.fixed = data.fixed
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
// 是否双击
|
|
737
|
-
if (data.dbclick) {
|
|
738
|
-
obj.dbclick = data.dbclick
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
// 请求表格参数
|
|
742
|
-
if (setRequestQuery('list') === false) {
|
|
743
|
-
return false
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
// 请求传参参数
|
|
748
|
-
if (setRequestQuery('query') === false) {
|
|
749
|
-
return false
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// 如果数据类型为新窗口
|
|
753
|
-
if (props.dataType === dicts.POWER_DATA_TYPE__OPEN) {
|
|
754
|
-
|
|
755
|
-
// 如果是非路由
|
|
756
|
-
if (props.routeType === 0) {
|
|
757
|
-
|
|
758
|
-
// 如果没有选择跳转页面
|
|
759
|
-
if (! data.toPage) {
|
|
760
|
-
// 轻提示
|
|
761
|
-
$n_toast({
|
|
762
|
-
message: '请选择跳转页面',
|
|
763
|
-
})
|
|
764
|
-
return false
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// 如果禁止添加来源页面参数
|
|
769
|
-
if (data.noFromPageQuery) {
|
|
770
|
-
obj.noFromPageQuery = true
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
// 否则为其他
|
|
774
|
-
} else {
|
|
775
|
-
|
|
776
|
-
// 是否确认
|
|
777
|
-
if (data.confirm) {
|
|
778
|
-
|
|
779
|
-
// 如果是(1:提交前确认)
|
|
780
|
-
if (data.confirm === 1) {
|
|
781
|
-
obj.confirm = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
782
|
-
|
|
783
|
-
// 否则是(2:提交前确认登录密码)
|
|
784
|
-
} else {
|
|
785
|
-
obj.confirmPassword = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// 请求成功执行
|
|
790
|
-
if (data.requestSuccess.type) {
|
|
791
|
-
obj.requestSuccess = {
|
|
792
|
-
type: data.requestSuccess.type
|
|
793
|
-
}
|
|
794
|
-
// if ($n_indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
795
|
-
// if (data.requestSuccess.params) {
|
|
796
|
-
// obj.requestSuccess.params = data.requestSuccess.params
|
|
797
|
-
// } else {
|
|
798
|
-
// obj.requestSuccess.type = 'close'
|
|
799
|
-
// }
|
|
800
|
-
// }
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
// 如果有 跳转页面 / 重定向 URL
|
|
806
|
-
if ($n_isValidValue(data.toPage)) {
|
|
807
|
-
|
|
808
|
-
// 如果定义了 url
|
|
809
|
-
if ($n_isValidValue(props.url)) {
|
|
810
|
-
// 轻提示
|
|
811
|
-
$n_toast({
|
|
812
|
-
message: `如果定义了【${props.dataType === dicts.POWER_DATA_TYPE__OPEN ? '跳转页面' : '重定向 URL'}】,则 URL 必须为空`,
|
|
813
|
-
})
|
|
814
|
-
return false
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
// 设置跳转页面 id
|
|
818
|
-
obj.toPage = data.toPage
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
// 自定义参数
|
|
822
|
-
const params = formatParams(data.params)
|
|
823
|
-
if ($n_isRequired(params)) {
|
|
824
|
-
obj.params = params
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
// 转为 json
|
|
829
|
-
return $n_isValidObject(obj) ? $n_json.stringify(obj) : ''
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// ==========【返回】=============================================================================================
|
|
833
|
-
|
|
834
|
-
return {
|
|
835
|
-
// 表单数据
|
|
836
|
-
formData,
|
|
837
|
-
|
|
838
|
-
// 获取格式化后的表单数据
|
|
839
|
-
getValue,
|
|
840
|
-
|
|
841
|
-
dicts,
|
|
842
|
-
arr: $n_arr,
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="col-xs-12 row q-col-gutter-lg">
|
|
3
|
+
|
|
4
|
+
<!-- 栏目标题 -->
|
|
5
|
+
<n-column-title label="数据配置" />
|
|
6
|
+
|
|
7
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
8
|
+
<slot/>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<template v-if="dataType">
|
|
12
|
+
|
|
13
|
+
<!-- 设置重定向 URL -->
|
|
14
|
+
<div class="col-xs-12 col-sm-6 col-md-3" v-if="! url">
|
|
15
|
+
|
|
16
|
+
<!-- 树 -->
|
|
17
|
+
<n-field-tree
|
|
18
|
+
class="n-field-fieldset"
|
|
19
|
+
:label="dataType === dicts.POWER_DATA_TYPE__OPEN ? '跳转页面' : '重定向 URL'"
|
|
20
|
+
outlined
|
|
21
|
+
clearable
|
|
22
|
+
stack-label
|
|
23
|
+
dense
|
|
24
|
+
|
|
25
|
+
v-model="formData.toPage"
|
|
26
|
+
:nodes="treeNodes"
|
|
27
|
+
:expanded="treeExpanded"
|
|
28
|
+
strict
|
|
29
|
+
accordion
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<!-- 列表有效 -->
|
|
34
|
+
<template v-if="dataType === dicts.POWER_DATA_TYPE__LIST">
|
|
35
|
+
|
|
36
|
+
<!-- 列表选择类型 -->
|
|
37
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
38
|
+
<q-select
|
|
39
|
+
class="n-field-fieldset"
|
|
40
|
+
label="选择类型"
|
|
41
|
+
v-model="formData.selection"
|
|
42
|
+
:options="[
|
|
43
|
+
{ label: '无', value: 'none' },
|
|
44
|
+
{ label: '单选', value: 'single' },
|
|
45
|
+
{ label: '多选', value: 'multiple' },
|
|
46
|
+
]"
|
|
47
|
+
map-options
|
|
48
|
+
emit-value
|
|
49
|
+
outlined
|
|
50
|
+
stack-label
|
|
51
|
+
dense
|
|
52
|
+
options-dense
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<!-- 非列表有效 -->
|
|
59
|
+
<template v-else>
|
|
60
|
+
|
|
61
|
+
<!-- 新窗口有效 -->
|
|
62
|
+
<template v-if="dataType === dicts.POWER_DATA_TYPE__OPEN">
|
|
63
|
+
|
|
64
|
+
<!-- 是否记录来源页面 -->
|
|
65
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
66
|
+
<q-select
|
|
67
|
+
class="n-field-fieldset"
|
|
68
|
+
label="来源页面参数"
|
|
69
|
+
v-model="formData.noFromPageQuery"
|
|
70
|
+
:options="[
|
|
71
|
+
{ label: '自动添加', value: false },
|
|
72
|
+
{ label: '禁止添加', value: true },
|
|
73
|
+
]"
|
|
74
|
+
map-options
|
|
75
|
+
emit-value
|
|
76
|
+
outlined
|
|
77
|
+
stack-label
|
|
78
|
+
dense
|
|
79
|
+
options-dense
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<!-- 非表单显示 -->
|
|
86
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
87
|
+
|
|
88
|
+
<!-- 显示类型 -->
|
|
89
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
90
|
+
<q-select
|
|
91
|
+
class="n-field-fieldset"
|
|
92
|
+
label="显示类型"
|
|
93
|
+
v-model="formData.show"
|
|
94
|
+
:options="[
|
|
95
|
+
{ label: '始终显示', value: '' },
|
|
96
|
+
{ label: '单选显示', value: 'single' },
|
|
97
|
+
{ label: '多选显示', value: 'multiple' },
|
|
98
|
+
]"
|
|
99
|
+
map-options
|
|
100
|
+
emit-value
|
|
101
|
+
outlined
|
|
102
|
+
stack-label
|
|
103
|
+
dense
|
|
104
|
+
options-dense
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<!-- 是否固定列 -->
|
|
109
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
110
|
+
<q-select
|
|
111
|
+
class="n-field-fieldset"
|
|
112
|
+
label="是否固定列"
|
|
113
|
+
v-model="formData.fixed"
|
|
114
|
+
:options="[
|
|
115
|
+
{ label: '否', value: false },
|
|
116
|
+
{ label: '是', value: true },
|
|
117
|
+
]"
|
|
118
|
+
map-options
|
|
119
|
+
emit-value
|
|
120
|
+
outlined
|
|
121
|
+
stack-label
|
|
122
|
+
dense
|
|
123
|
+
options-dense
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<!-- 是否双击 -->
|
|
128
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
129
|
+
<q-select
|
|
130
|
+
class="n-field-fieldset"
|
|
131
|
+
label="是否双击"
|
|
132
|
+
v-model="formData.dbclick"
|
|
133
|
+
:options="[
|
|
134
|
+
{ label: '否', value: false },
|
|
135
|
+
{ label: '是', value: true },
|
|
136
|
+
]"
|
|
137
|
+
map-options
|
|
138
|
+
emit-value
|
|
139
|
+
outlined
|
|
140
|
+
stack-label
|
|
141
|
+
dense
|
|
142
|
+
options-dense
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<!-- 如果为非新窗口 -->
|
|
148
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__OPEN">
|
|
149
|
+
|
|
150
|
+
<!-- 是否表单验证 -->
|
|
151
|
+
<div class="col-xs-12 col-sm-6 col-md-3" v-if="dataType === dicts.POWER_DATA_TYPE__FORM">
|
|
152
|
+
<q-select
|
|
153
|
+
class="n-field-fieldset"
|
|
154
|
+
label="提交前验证表单"
|
|
155
|
+
v-model="formData.validate"
|
|
156
|
+
:options="[
|
|
157
|
+
{ label: '关闭表单验证', value: false },
|
|
158
|
+
{ label: '开启表单验证', value: true },
|
|
159
|
+
]"
|
|
160
|
+
map-options
|
|
161
|
+
emit-value
|
|
162
|
+
outlined
|
|
163
|
+
stack-label
|
|
164
|
+
dense
|
|
165
|
+
options-dense
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<!-- 是否确认 -->
|
|
170
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
171
|
+
<q-select
|
|
172
|
+
class="n-field-fieldset"
|
|
173
|
+
label="提交前确认"
|
|
174
|
+
v-model="formData.confirm"
|
|
175
|
+
:options="[
|
|
176
|
+
{ label: '否', value: 0 },
|
|
177
|
+
{ label: '提交前确认', value: 1 },
|
|
178
|
+
{ label: '提交前确认登录密码', value: 2 },
|
|
179
|
+
]"
|
|
180
|
+
map-options
|
|
181
|
+
emit-value
|
|
182
|
+
outlined
|
|
183
|
+
stack-label
|
|
184
|
+
dense
|
|
185
|
+
options-dense
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<!-- 确认提示内容 -->
|
|
190
|
+
<div class="col-xs-12 col-sm-6 col-md-3" v-if="formData.confirm > 0">
|
|
191
|
+
<q-input
|
|
192
|
+
class="n-field-fieldset"
|
|
193
|
+
label="确认提示内容"
|
|
194
|
+
v-model="formData.confirmContent"
|
|
195
|
+
:placeholder="formData.confirm === 1 ? '确认要执行该操作吗?' : '重要操作,请输入登录密码并确认后操作'"
|
|
196
|
+
outlined
|
|
197
|
+
clearable
|
|
198
|
+
stack-label
|
|
199
|
+
dense
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<!-- 请求成功执行 -->
|
|
204
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
205
|
+
<q-select
|
|
206
|
+
class="n-field-fieldset"
|
|
207
|
+
label="请求成功执行"
|
|
208
|
+
v-model="formData.requestSuccess.type"
|
|
209
|
+
:options="dataType === dicts.POWER_DATA_TYPE__FORM ?
|
|
210
|
+
[
|
|
211
|
+
{ label: '无', value: '' },
|
|
212
|
+
{ label: '关闭窗口', value: 'close' },
|
|
213
|
+
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
214
|
+
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
215
|
+
{ label: '重置表单', value: 'resetForm' },
|
|
216
|
+
] :
|
|
217
|
+
[
|
|
218
|
+
{ label: '无', value: '' },
|
|
219
|
+
{ label: '关闭窗口', value: 'close' },
|
|
220
|
+
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
221
|
+
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
222
|
+
{ label: '刷新列表', value: 'refreshList' },
|
|
223
|
+
]
|
|
224
|
+
"
|
|
225
|
+
map-options
|
|
226
|
+
emit-value
|
|
227
|
+
outlined
|
|
228
|
+
stack-label
|
|
229
|
+
dense
|
|
230
|
+
options-dense
|
|
231
|
+
/>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<!-- 请求成功参数 -->
|
|
235
|
+
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n_indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
236
|
+
|
|
237
|
+
<!-- <!– 树 –>-->
|
|
238
|
+
<!-- <n-field-tree-->
|
|
239
|
+
<!-- class="n-field-fieldset"-->
|
|
240
|
+
<!-- label="跳转页面"-->
|
|
241
|
+
<!-- outlined-->
|
|
242
|
+
<!-- clearable-->
|
|
243
|
+
<!-- stack-label-->
|
|
244
|
+
<!-- dense-->
|
|
245
|
+
|
|
246
|
+
<!-- v-model="formData.requestSuccess.params"-->
|
|
247
|
+
<!-- :nodes="treeNodes"-->
|
|
248
|
+
<!-- :expanded="treeExpanded"-->
|
|
249
|
+
<!-- strict-->
|
|
250
|
+
<!-- accordion-->
|
|
251
|
+
<!-- />-->
|
|
252
|
+
<!--</div>-->
|
|
253
|
+
|
|
254
|
+
</template>
|
|
255
|
+
|
|
256
|
+
<!-- 如果为非表单 -->
|
|
257
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
258
|
+
|
|
259
|
+
<!-- 栏目标题 -->
|
|
260
|
+
<n-column-title label="请求列表参数" tooltip='示例:id / sku_id AS sku' />
|
|
261
|
+
|
|
262
|
+
<!-- 表格请求参数 -->
|
|
263
|
+
<div class="col-xs-12">
|
|
264
|
+
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
265
|
+
<q-item
|
|
266
|
+
v-for="(item, itemIndex) in formData.requestQuery.list"
|
|
267
|
+
>
|
|
268
|
+
<q-item-section>
|
|
269
|
+
<q-input
|
|
270
|
+
class="n-field-fieldset"
|
|
271
|
+
v-model="formData.requestQuery.list[itemIndex]"
|
|
272
|
+
placeholder="请输入参数"
|
|
273
|
+
outlined
|
|
274
|
+
clearable
|
|
275
|
+
stack-label
|
|
276
|
+
dense
|
|
277
|
+
/>
|
|
278
|
+
</q-item-section>
|
|
279
|
+
|
|
280
|
+
<q-item-section side>
|
|
281
|
+
<div class="text-grey-8 q-gutter-xs">
|
|
282
|
+
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.list, itemIndex, '')" />
|
|
283
|
+
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
284
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
285
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.list, itemIndex)" :disable="formData.requestQuery.list.length <= itemIndex + 1" />
|
|
286
|
+
</div>
|
|
287
|
+
</q-item-section>
|
|
288
|
+
</q-item>
|
|
289
|
+
</q-list>
|
|
290
|
+
</div>
|
|
291
|
+
</template>
|
|
292
|
+
|
|
293
|
+
<!-- 栏目标题 -->
|
|
294
|
+
<n-column-title label="请求传参参数" tooltip='示例:id / sku_id AS sku / { "type": 1, "name": "age" }' />
|
|
295
|
+
|
|
296
|
+
<!-- 表格请求参数 -->
|
|
297
|
+
<div class="col-xs-12">
|
|
298
|
+
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
299
|
+
<q-item
|
|
300
|
+
v-for="(item, itemIndex) in formData.requestQuery.query"
|
|
301
|
+
>
|
|
302
|
+
<q-item-section>
|
|
303
|
+
<q-input
|
|
304
|
+
class="n-field-fieldset"
|
|
305
|
+
v-model="formData.requestQuery.query[itemIndex]"
|
|
306
|
+
placeholder="请输入参数"
|
|
307
|
+
outlined
|
|
308
|
+
clearable
|
|
309
|
+
stack-label
|
|
310
|
+
dense
|
|
311
|
+
/>
|
|
312
|
+
</q-item-section>
|
|
313
|
+
|
|
314
|
+
<q-item-section side>
|
|
315
|
+
<div class="text-grey-8 q-gutter-xs">
|
|
316
|
+
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
317
|
+
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
318
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
319
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
320
|
+
</div>
|
|
321
|
+
</q-item-section>
|
|
322
|
+
</q-item>
|
|
323
|
+
</q-list>
|
|
324
|
+
</div>
|
|
325
|
+
</template>
|
|
326
|
+
|
|
327
|
+
<!-- 栏目标题 -->
|
|
328
|
+
<n-column-title label="自定义参数" tooltip='示例:123 / id / [1, 2, 3] / { "type": 1, "name": "age" }' />
|
|
329
|
+
|
|
330
|
+
<!-- 自定义参数 -->
|
|
331
|
+
<div class="col-xs-12">
|
|
332
|
+
<q-input
|
|
333
|
+
style="max-width:800px"
|
|
334
|
+
class="n-field-fieldset"
|
|
335
|
+
v-model="formData.params"
|
|
336
|
+
placeholder="请输入参数"
|
|
337
|
+
outlined
|
|
338
|
+
clearable
|
|
339
|
+
stack-label
|
|
340
|
+
dense
|
|
341
|
+
autogrow
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
</template>
|
|
345
|
+
</div>
|
|
346
|
+
</template>
|
|
347
|
+
|
|
348
|
+
<script>
|
|
349
|
+
import { ref, watch } from 'vue'
|
|
350
|
+
|
|
351
|
+
import NColumnTitle from '../../column-title'
|
|
352
|
+
import NFieldTree from '../../field-tree'
|
|
353
|
+
|
|
354
|
+
import $n_has from 'lodash/has'
|
|
355
|
+
import $n_isPlainObject from 'lodash/isPlainObject'
|
|
356
|
+
|
|
357
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
358
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
359
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
360
|
+
|
|
361
|
+
import $n_isRequired from '@netang/utils/isRequired'
|
|
362
|
+
import $n_forIn from '@netang/utils/forIn'
|
|
363
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
364
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
365
|
+
import $n_trimString from '@netang/utils/trimString'
|
|
366
|
+
import $n_isJson from '@netang/utils/isJson'
|
|
367
|
+
import $n_json from '@netang/utils/json'
|
|
368
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
369
|
+
|
|
370
|
+
import $n_arr from '../../../utils/arr'
|
|
371
|
+
import $n_toast from '../../../utils/toast'
|
|
372
|
+
|
|
373
|
+
import { configs } from '../../../utils/config'
|
|
374
|
+
|
|
375
|
+
const {
|
|
376
|
+
// 字典常量
|
|
377
|
+
dicts,
|
|
378
|
+
} = configs
|
|
379
|
+
|
|
380
|
+
export default {
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 声明属性
|
|
384
|
+
*/
|
|
385
|
+
props: {
|
|
386
|
+
// 值
|
|
387
|
+
modelValue: String,
|
|
388
|
+
// URL
|
|
389
|
+
url: String,
|
|
390
|
+
// 数据类型
|
|
391
|
+
dataType: Number,
|
|
392
|
+
// 路由类型
|
|
393
|
+
routeType: Number,
|
|
394
|
+
// 树节点数组
|
|
395
|
+
treeNodes: Array,
|
|
396
|
+
// 树展开节点
|
|
397
|
+
treeExpanded: Array,
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* 组件
|
|
402
|
+
*/
|
|
403
|
+
components: {
|
|
404
|
+
NColumnTitle,
|
|
405
|
+
NFieldTree,
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* 组合式
|
|
410
|
+
*/
|
|
411
|
+
setup(props) {
|
|
412
|
+
|
|
413
|
+
// ==========【数据】=============================================================================================
|
|
414
|
+
|
|
415
|
+
// 表单数据
|
|
416
|
+
const formData = ref(formatModelValue())
|
|
417
|
+
|
|
418
|
+
// ==========【监听数据】=========================================================================================
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* 监听值
|
|
422
|
+
*/
|
|
423
|
+
watch(()=>props.modelValue, function() {
|
|
424
|
+
|
|
425
|
+
// 格式化传值
|
|
426
|
+
formData.value = formatModelValue()
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* 监听数据类型
|
|
431
|
+
*/
|
|
432
|
+
watch(()=>props.dataType, function (val) {
|
|
433
|
+
|
|
434
|
+
// 如果数据类型为新窗口
|
|
435
|
+
if (val === dicts.POWER_DATA_TYPE__FORM) {
|
|
436
|
+
if (formData.value.requestSuccess.type === 'refreshList') {
|
|
437
|
+
formData.value.requestSuccess.type = ''
|
|
438
|
+
formData.value.requestSuccess.params = ''
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// 如果数据类型为数据
|
|
442
|
+
} else if (val === dicts.POWER_DATA_TYPE__DATA) {
|
|
443
|
+
if (formData.value.requestSuccess.type === 'resetForm') {
|
|
444
|
+
formData.value.requestSuccess.type = ''
|
|
445
|
+
formData.value.requestSuccess.params = ''
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
// ==========【方法】============================================================================================
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* 格式化传值
|
|
454
|
+
*/
|
|
455
|
+
function formatModelValue() {
|
|
456
|
+
|
|
457
|
+
let obj = {}
|
|
458
|
+
|
|
459
|
+
if ($n_isJson(props.modelValue)) {
|
|
460
|
+
const data = $n_json.parse(props.modelValue)
|
|
461
|
+
if ($n_isValidObject(data)) {
|
|
462
|
+
obj = data
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// 原始数据默认值
|
|
467
|
+
const rawObj = {
|
|
468
|
+
// 列表选择类型, 可选值 none single(默认) multiple
|
|
469
|
+
selection: '',
|
|
470
|
+
// 显示类型, 可选 single / multiple / 空(默认显示)
|
|
471
|
+
show: '',
|
|
472
|
+
// 禁止添加来源页面参数
|
|
473
|
+
noFromPageQuery: false,
|
|
474
|
+
// 页面 ID (跳转页面 / 重定向 URL)
|
|
475
|
+
toPage: '',
|
|
476
|
+
// 是否固定列
|
|
477
|
+
fixed: false,
|
|
478
|
+
// 是否双击: 可选 true / false
|
|
479
|
+
dbclick: false,
|
|
480
|
+
// 是否表单验证: 可选 true / false
|
|
481
|
+
validate: true,
|
|
482
|
+
// 是否确认: 可选 true / false / 字符串(确认提示的内容)
|
|
483
|
+
confirm: false,
|
|
484
|
+
// 是否确认密码: 可选 true / false / 字符串(确认提示的内容)
|
|
485
|
+
confirmPassword: false,
|
|
486
|
+
// 请求参数
|
|
487
|
+
requestQuery: {
|
|
488
|
+
// 列表: 字符串组成的数组, 如: [ "id", "sku_id AS sku" ]
|
|
489
|
+
list: [],
|
|
490
|
+
// 参数: 字符串 / 对象(自定义参数) 组成的数组, 如: [ "id", "sku_id AS sku", { "type": 1, "name": "age" } ]
|
|
491
|
+
query: null,
|
|
492
|
+
},
|
|
493
|
+
// 请求成功执行
|
|
494
|
+
requestSuccess: {
|
|
495
|
+
// 类型, 可选 close / closePush / closePushRefresh / resetForm / refreshList / 空(不执行)
|
|
496
|
+
type: '',
|
|
497
|
+
// 参数
|
|
498
|
+
params: '',
|
|
499
|
+
},
|
|
500
|
+
// 自定义参数, 任意类型
|
|
501
|
+
params: '',
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// 【格式化数据】删除无效键值
|
|
505
|
+
// --------------------------------------------------
|
|
506
|
+
|
|
507
|
+
// 原始键值
|
|
508
|
+
const rawKeys = Object.keys(rawObj)
|
|
509
|
+
|
|
510
|
+
// 删除数据中的无效键值
|
|
511
|
+
$n_forIn(obj, function (item, key) {
|
|
512
|
+
// 如果键值不在原始键值中
|
|
513
|
+
if (rawKeys.indexOf(key) === -1) {
|
|
514
|
+
// 则删除
|
|
515
|
+
delete obj[key]
|
|
516
|
+
}
|
|
517
|
+
})
|
|
518
|
+
|
|
519
|
+
// 判断 requestSuccess 值是否合法
|
|
520
|
+
if ($n_has(obj, 'requestSuccess') && ! $n_isValidObject(obj.requestSuccess)) {
|
|
521
|
+
delete(obj.requestSuccess)
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// 判断 requestQuery 值是否合法
|
|
525
|
+
if ($n_has(obj, 'requestQuery') && ! $n_isValidObject(obj.requestQuery)) {
|
|
526
|
+
delete(obj.requestQuery)
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// --------------------------------------------------
|
|
530
|
+
|
|
531
|
+
// 合并原始数据
|
|
532
|
+
obj = Object.assign(rawObj, obj)
|
|
533
|
+
|
|
534
|
+
// 列表选择类型默认值为 single
|
|
535
|
+
if (! $n_isValidString(obj.selection)) {
|
|
536
|
+
obj.selection = 'single'
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// 【格式化是否确认参数】
|
|
540
|
+
// ------------------------------------------------------------
|
|
541
|
+
// 是否确认, 可选 0:无 / 1:提交前确认 / 2:提交前确认登录密码
|
|
542
|
+
let confirm = 0
|
|
543
|
+
// 确认提示内容
|
|
544
|
+
obj.confirmContent = ''
|
|
545
|
+
if (obj.confirmPassword) {
|
|
546
|
+
confirm = 2
|
|
547
|
+
if ($n_isValidString(obj.confirmPassword)) {
|
|
548
|
+
obj.confirmContent = obj.confirmPassword
|
|
549
|
+
}
|
|
550
|
+
} else if (obj.confirm) {
|
|
551
|
+
confirm = 1
|
|
552
|
+
if ($n_isValidString(obj.confirm)) {
|
|
553
|
+
obj.confirmContent = obj.confirm
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
obj.confirm = confirm
|
|
557
|
+
delete obj.confirmPassword
|
|
558
|
+
|
|
559
|
+
// 【格式化请求参数中的 list】
|
|
560
|
+
// ------------------------------------------------------------
|
|
561
|
+
if ($n_isValidString(obj.requestQuery.list)) {
|
|
562
|
+
obj.requestQuery.list = [obj.requestQuery.list]
|
|
563
|
+
} else if (! $n_isValidArray(obj.requestQuery.list)) {
|
|
564
|
+
obj.requestQuery.list = ['']
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// 【格式化请求参数中的 query】
|
|
568
|
+
// ------------------------------------------------------------
|
|
569
|
+
if ($n_has(obj.requestQuery, 'query')) {
|
|
570
|
+
|
|
571
|
+
// 如果是有效值
|
|
572
|
+
if ($n_isValidValue(obj.requestQuery.query)) {
|
|
573
|
+
obj.requestQuery.query = [obj.requestQuery.query]
|
|
574
|
+
|
|
575
|
+
// 如果是有效对象
|
|
576
|
+
} else if ($n_isValidObject(obj.requestQuery.query)) {
|
|
577
|
+
obj.requestQuery.query = [$n_json.stringify(obj.requestQuery.query)]
|
|
578
|
+
|
|
579
|
+
// 如果是有效数组
|
|
580
|
+
} else if ($n_isValidArray(obj.requestQuery.query)) {
|
|
581
|
+
const query = []
|
|
582
|
+
$n_forEach(obj.requestQuery.query, function(item) {
|
|
583
|
+
|
|
584
|
+
// 如果是有效值
|
|
585
|
+
if ($n_isValidValue(item)) {
|
|
586
|
+
query.push(item)
|
|
587
|
+
|
|
588
|
+
// 如果是对象
|
|
589
|
+
} else if ($n_isValidObject(item)) {
|
|
590
|
+
query.push($n_json.stringify(item))
|
|
591
|
+
}
|
|
592
|
+
})
|
|
593
|
+
obj.requestQuery.query = query.length ? query : ['']
|
|
594
|
+
|
|
595
|
+
// 否则没有数据
|
|
596
|
+
} else {
|
|
597
|
+
obj.requestQuery.query = ['']
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// 否则没有数据
|
|
601
|
+
} else {
|
|
602
|
+
obj.requestQuery.query = ['']
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// 【格式化其他参数】
|
|
606
|
+
// ------------------------------------------------------------
|
|
607
|
+
if (! $n_has(obj, 'params')) {
|
|
608
|
+
obj.params = ''
|
|
609
|
+
|
|
610
|
+
// 如果不是字符串
|
|
611
|
+
} else if (! $n_isValidString(obj.params)) {
|
|
612
|
+
if ($n_isValidObject(obj.params)) {
|
|
613
|
+
obj.params = $n_json.stringify(obj.params)
|
|
614
|
+
} else if ($n_isValidArray(obj.params)) {
|
|
615
|
+
obj.params = $n_json.stringify(obj.params)
|
|
616
|
+
} else {
|
|
617
|
+
obj.params = ''
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
// ------------------------------------------------------------
|
|
621
|
+
|
|
622
|
+
return obj
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* 获取格式化后的表单数据
|
|
627
|
+
*/
|
|
628
|
+
function getValue() {
|
|
629
|
+
|
|
630
|
+
const obj = {}
|
|
631
|
+
|
|
632
|
+
// 获取表单数据
|
|
633
|
+
const data = formData.value
|
|
634
|
+
|
|
635
|
+
// 如果有选择数据类型
|
|
636
|
+
if (props.dataType) {
|
|
637
|
+
|
|
638
|
+
// 设置请求参数
|
|
639
|
+
function setRequestQuery(field) {
|
|
640
|
+
|
|
641
|
+
// 请求表格参数
|
|
642
|
+
const lists = []
|
|
643
|
+
|
|
644
|
+
$n_forEach(data.requestQuery[field], function(value) {
|
|
645
|
+
|
|
646
|
+
value = formatParams(value)
|
|
647
|
+
|
|
648
|
+
// 如果有值
|
|
649
|
+
if ($n_isRequired(value)) {
|
|
650
|
+
|
|
651
|
+
// 如果为表格
|
|
652
|
+
if (field === 'list') {
|
|
653
|
+
|
|
654
|
+
if (Array.isArray(value) || $n_isPlainObject(value)) {
|
|
655
|
+
|
|
656
|
+
// 轻提示
|
|
657
|
+
$n_toast({
|
|
658
|
+
message: '请求列表参数格式不能是数组或对象',
|
|
659
|
+
})
|
|
660
|
+
return false
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// 否则为参数
|
|
664
|
+
} else if (Array.isArray(value)) {
|
|
665
|
+
// 轻提示
|
|
666
|
+
$n_toast({
|
|
667
|
+
message: '请求传参参数格式不能是数组',
|
|
668
|
+
})
|
|
669
|
+
return false
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// 如果是字符串
|
|
673
|
+
lists.push(value)
|
|
674
|
+
}
|
|
675
|
+
})
|
|
676
|
+
|
|
677
|
+
if (lists.length) {
|
|
678
|
+
if (! $n_has(obj, 'requestQuery')) {
|
|
679
|
+
obj.requestQuery = {}
|
|
680
|
+
}
|
|
681
|
+
obj.requestQuery[field] = lists.length === 1 ? lists[0] : lists
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return true
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// 格式化其他参数
|
|
688
|
+
function formatParams(value) {
|
|
689
|
+
value = $n_trimString(value)
|
|
690
|
+
if (
|
|
691
|
+
(value.startsWith('[') || value.startsWith('{'))
|
|
692
|
+
&& $n_isJson(value)
|
|
693
|
+
) {
|
|
694
|
+
value = $n_json.parse(value)
|
|
695
|
+
|
|
696
|
+
if (! Array.isArray(value) && ! $n_isPlainObject(value)) {
|
|
697
|
+
return ''
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return value
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// 如果列表显示
|
|
704
|
+
// --------------------------------------------------
|
|
705
|
+
if (props.dataType === dicts.POWER_DATA_TYPE__LIST) {
|
|
706
|
+
|
|
707
|
+
// 列表选择类型
|
|
708
|
+
if ($n_indexOf(['none', 'multiple'], data.selection) > -1) {
|
|
709
|
+
obj.selection = data.selection
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
} else {
|
|
713
|
+
|
|
714
|
+
// 如果表单显示
|
|
715
|
+
// --------------------------------------------------
|
|
716
|
+
if (props.dataType === dicts.POWER_DATA_TYPE__FORM) {
|
|
717
|
+
|
|
718
|
+
// 关闭表单验证(默认开启)
|
|
719
|
+
if (data.validate === false) {
|
|
720
|
+
obj.validate = false
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// 如果非表单显示
|
|
724
|
+
} else {
|
|
725
|
+
|
|
726
|
+
// 显示类型
|
|
727
|
+
if (data.show) {
|
|
728
|
+
obj.show = data.show
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// 是否固定列
|
|
732
|
+
if (data.fixed) {
|
|
733
|
+
obj.fixed = data.fixed
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// 是否双击
|
|
737
|
+
if (data.dbclick) {
|
|
738
|
+
obj.dbclick = data.dbclick
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// 请求表格参数
|
|
742
|
+
if (setRequestQuery('list') === false) {
|
|
743
|
+
return false
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// 请求传参参数
|
|
748
|
+
if (setRequestQuery('query') === false) {
|
|
749
|
+
return false
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// 如果数据类型为新窗口
|
|
753
|
+
if (props.dataType === dicts.POWER_DATA_TYPE__OPEN) {
|
|
754
|
+
|
|
755
|
+
// 如果是非路由
|
|
756
|
+
if (props.routeType === 0) {
|
|
757
|
+
|
|
758
|
+
// 如果没有选择跳转页面
|
|
759
|
+
if (! data.toPage) {
|
|
760
|
+
// 轻提示
|
|
761
|
+
$n_toast({
|
|
762
|
+
message: '请选择跳转页面',
|
|
763
|
+
})
|
|
764
|
+
return false
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// 如果禁止添加来源页面参数
|
|
769
|
+
if (data.noFromPageQuery) {
|
|
770
|
+
obj.noFromPageQuery = true
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// 否则为其他
|
|
774
|
+
} else {
|
|
775
|
+
|
|
776
|
+
// 是否确认
|
|
777
|
+
if (data.confirm) {
|
|
778
|
+
|
|
779
|
+
// 如果是(1:提交前确认)
|
|
780
|
+
if (data.confirm === 1) {
|
|
781
|
+
obj.confirm = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
782
|
+
|
|
783
|
+
// 否则是(2:提交前确认登录密码)
|
|
784
|
+
} else {
|
|
785
|
+
obj.confirmPassword = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// 请求成功执行
|
|
790
|
+
if (data.requestSuccess.type) {
|
|
791
|
+
obj.requestSuccess = {
|
|
792
|
+
type: data.requestSuccess.type
|
|
793
|
+
}
|
|
794
|
+
// if ($n_indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
795
|
+
// if (data.requestSuccess.params) {
|
|
796
|
+
// obj.requestSuccess.params = data.requestSuccess.params
|
|
797
|
+
// } else {
|
|
798
|
+
// obj.requestSuccess.type = 'close'
|
|
799
|
+
// }
|
|
800
|
+
// }
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// 如果有 跳转页面 / 重定向 URL
|
|
806
|
+
if ($n_isValidValue(data.toPage)) {
|
|
807
|
+
|
|
808
|
+
// 如果定义了 url
|
|
809
|
+
if ($n_isValidValue(props.url)) {
|
|
810
|
+
// 轻提示
|
|
811
|
+
$n_toast({
|
|
812
|
+
message: `如果定义了【${props.dataType === dicts.POWER_DATA_TYPE__OPEN ? '跳转页面' : '重定向 URL'}】,则 URL 必须为空`,
|
|
813
|
+
})
|
|
814
|
+
return false
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// 设置跳转页面 id
|
|
818
|
+
obj.toPage = data.toPage
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// 自定义参数
|
|
822
|
+
const params = formatParams(data.params)
|
|
823
|
+
if ($n_isRequired(params)) {
|
|
824
|
+
obj.params = params
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// 转为 json
|
|
829
|
+
return $n_isValidObject(obj) ? $n_json.stringify(obj) : ''
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// ==========【返回】=============================================================================================
|
|
833
|
+
|
|
834
|
+
return {
|
|
835
|
+
// 表单数据
|
|
836
|
+
formData,
|
|
837
|
+
|
|
838
|
+
// 获取格式化后的表单数据
|
|
839
|
+
getValue,
|
|
840
|
+
|
|
841
|
+
dicts,
|
|
842
|
+
arr: $n_arr,
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
</script>
|