free-fe-core-modules 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/components/.gitkeep +0 -0
- package/components/Basic/BreadCrumbs.vue +87 -0
- package/components/Basic/EIcon.vue +84 -0
- package/components/Basic/LeveledMenus.vue +92 -0
- package/components/Basic/SummaryHead.vue +312 -0
- package/components/Dialog/BasicDialog.vue +442 -0
- package/components/Dialog/index.js +38 -0
- package/components/Dialog/index1.js +49 -0
- package/components/FloatingWindow/index.vue +140 -0
- package/components/SelectLocales/index.vue +47 -0
- package/components/SlidingCarousel/index.vue +86 -0
- package/components/SlidingNews/index.vue +138 -0
- package/components/StickyButtons/index.vue +98 -0
- package/components/ThemeSwitch/index.vue +77 -0
- package/field-components/Display/index.js +3 -0
- package/field-components/Fields/AgreementCheck.vue +161 -0
- package/field-components/Fields/ApiCall.vue +139 -0
- package/field-components/Fields/Boolean.vue +112 -0
- package/field-components/Fields/Category.vue +33 -0
- package/field-components/Fields/Check.vue +131 -0
- package/field-components/Fields/Customize.vue +103 -0
- package/field-components/Fields/Date.vue +142 -0
- package/field-components/Fields/DateRange.vue +199 -0
- package/field-components/Fields/DynamicList.vue +575 -0
- package/field-components/Fields/FieldEditor.vue +379 -0
- package/field-components/Fields/File.vue +382 -0
- package/field-components/Fields/FileList.vue +405 -0
- package/field-components/Fields/FileListCombined.vue +142 -0
- package/field-components/Fields/FixedList.vue +372 -0
- package/field-components/Fields/Image.vue +328 -0
- package/field-components/Fields/ImageList.vue +285 -0
- package/field-components/Fields/ImageListCombined.vue +76 -0
- package/field-components/Fields/InputFieldList.vue +299 -0
- package/field-components/Fields/Labels.vue +182 -0
- package/field-components/Fields/MixedTable.vue +367 -0
- package/field-components/Fields/Number.vue +247 -0
- package/field-components/Fields/Password.vue +79 -0
- package/field-components/Fields/Permission.vue +83 -0
- package/field-components/Fields/PermissionEditor.vue +205 -0
- package/field-components/Fields/QueryFilters.vue +162 -0
- package/field-components/Fields/RadioList.vue +81 -0
- package/field-components/Fields/Rich.vue +369 -0
- package/field-components/Fields/Search.vue +499 -0
- package/field-components/Fields/Select.vue +376 -0
- package/field-components/Fields/SelectionChain.vue +198 -0
- package/field-components/Fields/Separator.vue +26 -0
- package/field-components/Fields/SingleList.vue +125 -0
- package/field-components/Fields/Static.vue +22 -0
- package/field-components/Fields/String.vue +185 -0
- package/field-components/Fields/Text.vue +89 -0
- package/field-components/Fields/Time.vue +160 -0
- package/field-components/Fields/TimeRange.vue +348 -0
- package/field-components/Fields/UltimateFile.vue +100 -0
- package/field-components/Fields/Year.vue +124 -0
- package/field-components/Fields/YearRange.vue +188 -0
- package/field-components/Fields/components/FieldTypeOptions.vue +248 -0
- package/field-components/Fields/index.js +117 -0
- package/field-components/components/FieldComponents.vue +246 -0
- package/field-components/index.js +13 -0
- package/field-components/style.sass +11 -0
- package/free-fields/AutoHide.js +66 -0
- package/free-fields/CenterContent.js +15 -0
- package/free-fields/Draggable.js +30 -0
- package/free-fields/Droppable.js +114 -0
- package/free-fields/EditableString.js +63 -0
- package/free-fields/FieldCategory.js +83 -0
- package/free-fields/FieldTypeSelect.js +94 -0
- package/free-fields/fieldEditors/arrayEditor.js +3 -0
- package/free-fields/fieldEditors/boolEditor.js +22 -0
- package/free-fields/fieldEditors/dateEditor.js +23 -0
- package/free-fields/fieldEditors/datetimeEditor.js +23 -0
- package/free-fields/fieldEditors/index.js +21 -0
- package/free-fields/fieldEditors/jsonEditor.js +371 -0
- package/free-fields/fieldEditors/labeledField.js +74 -0
- package/free-fields/fieldEditors/numberEditor.js +51 -0
- package/free-fields/fieldEditors/objectEditor.js +3 -0
- package/free-fields/fieldEditors/selectEditor.js +0 -0
- package/free-fields/fieldEditors/stringEditor.js +49 -0
- package/free-fields/fieldEditors/textEditor.js +50 -0
- package/free-fields/fieldEditors/timeEditor.js +23 -0
- package/free-fields/index.js +402 -0
- package/i18n/en-us/index.js +73 -0
- package/i18n/fields/en-us/index.js +9 -0
- package/i18n/fields/zh-cn/index.js +9 -0
- package/i18n/zh-cn/index.js +73 -0
- package/index.js +367 -0
- package/package.json +11 -0
- package/router/dict/api.js +18 -0
- package/router/dict/data.js +48 -0
- package/router/dict/index.js +7 -0
- package/router/error/api.js +14 -0
- package/router/error/data.js +33 -0
- package/router/error/index.js +9 -0
- package/router/index.js +13 -0
- package/router/menu/api.js +24 -0
- package/router/menu/data.js +85 -0
- package/router/menu/index.js +7 -0
- package/router/system/api.js +10 -0
- package/router/system/data.js +46 -0
- package/router/system/index.js +7 -0
- package/stores/index.js +17 -0
- package/stores/module-mourning/actions.js +3 -0
- package/stores/module-mourning/getters.js +1 -0
- package/stores/module-mourning/index.js +11 -0
- package/stores/module-mourning/state.js +3 -0
- package/stores/mourning.js +3 -0
- package/view/dict/index.vue +284 -0
- package/view/error/list.vue +197 -0
- package/view/menu/index.vue +332 -0
- package/view/mourning/mourning.vue +45 -0
- package/view/system/index.vue +149 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="simple-field input-field-number row items-center no-wrap"
|
|
4
|
+
v-if="Field"
|
|
5
|
+
>
|
|
6
|
+
<span
|
|
7
|
+
v-if="Field.ReadOnly"
|
|
8
|
+
class="full-width"
|
|
9
|
+
>
|
|
10
|
+
<span
|
|
11
|
+
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
12
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
13
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
14
|
+
>
|
|
15
|
+
<q-tooltip
|
|
16
|
+
v-if="Field.Description"
|
|
17
|
+
anchor="top right"
|
|
18
|
+
>{{Field.Description}}</q-tooltip>
|
|
19
|
+
{{Field.Label || ''}}
|
|
20
|
+
<span
|
|
21
|
+
v-if="Field.Required"
|
|
22
|
+
class="required-mark"
|
|
23
|
+
>*</span>
|
|
24
|
+
</span>
|
|
25
|
+
<span class="readonly-content">
|
|
26
|
+
<span
|
|
27
|
+
class="prefix"
|
|
28
|
+
v-if="Field.Options && Field.Options.Prefix"
|
|
29
|
+
>{{Field.Options.Prefix}}</span>
|
|
30
|
+
<span :style="(Field.Info && Field.Info.Style) ? Field.Info.Style : ''">{{fieldData}}</span>
|
|
31
|
+
<span
|
|
32
|
+
class="postfix"
|
|
33
|
+
v-if="Field.Options && Field.Options.Postfix"
|
|
34
|
+
>{{Field.Options.Postfix}}</span>
|
|
35
|
+
</span>
|
|
36
|
+
</span>
|
|
37
|
+
<q-input
|
|
38
|
+
v-else
|
|
39
|
+
:readonly="Field.ReadOnly"
|
|
40
|
+
v-bind="$attrs"
|
|
41
|
+
hide-bottom-space
|
|
42
|
+
@input="valueChanged"
|
|
43
|
+
type="number"
|
|
44
|
+
v-model.number="localData"
|
|
45
|
+
:ref="`input_field_validator_${Field.Name || Field.Label}`"
|
|
46
|
+
:maxlength="maxlength"
|
|
47
|
+
>
|
|
48
|
+
<template v-slot:before>
|
|
49
|
+
<span
|
|
50
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
51
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
52
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
53
|
+
>
|
|
54
|
+
<q-tooltip
|
|
55
|
+
v-if="Field.Description"
|
|
56
|
+
anchor="top right"
|
|
57
|
+
>{{Field.Description}}</q-tooltip>
|
|
58
|
+
{{Field.Label || ''}}
|
|
59
|
+
<span
|
|
60
|
+
v-if="Field.Required"
|
|
61
|
+
class="required-mark"
|
|
62
|
+
>*</span>
|
|
63
|
+
</span>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<template
|
|
67
|
+
v-slot:prepend
|
|
68
|
+
v-if="Field.Options && Field.Options.Prefix"
|
|
69
|
+
>
|
|
70
|
+
<span class="prefix">{{Field.Options.Prefix}}</span>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<template
|
|
74
|
+
v-slot:append
|
|
75
|
+
v-if="Field.Options && Field.Options.Postfix"
|
|
76
|
+
>
|
|
77
|
+
<span class="postfix">{{Field.Options.Postfix}}</span>
|
|
78
|
+
</template>
|
|
79
|
+
</q-input>
|
|
80
|
+
<slot name="warning"></slot>
|
|
81
|
+
</span>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
import { defineComponent } from 'vue';
|
|
86
|
+
import mixins from 'free-fe-mixins';
|
|
87
|
+
|
|
88
|
+
export default defineComponent({
|
|
89
|
+
name: 'InputFieldNumber',
|
|
90
|
+
mixins: [mixins.InputFieldMixin],
|
|
91
|
+
emits:['input'],
|
|
92
|
+
fieldInfo: {
|
|
93
|
+
Category: 'Simple',
|
|
94
|
+
Label: '数字',
|
|
95
|
+
Value: 'Number',
|
|
96
|
+
Extra: [
|
|
97
|
+
{
|
|
98
|
+
Type: 'String',
|
|
99
|
+
Label: '前缀',
|
|
100
|
+
Name: 'Options.Prefix',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
Type: 'String',
|
|
104
|
+
Label: '后缀',
|
|
105
|
+
Name: 'Options.Postfix',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
Type: 'Number',
|
|
109
|
+
Label: '最小值',
|
|
110
|
+
Name: 'MinValue',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
Type: 'Number',
|
|
114
|
+
Label: '最大值',
|
|
115
|
+
Name: 'MaxValue',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
Type: 'Number',
|
|
119
|
+
Label: '最大长度',
|
|
120
|
+
Name: 'Options.MaxLength',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
Type: 'DynamicList',
|
|
124
|
+
Label: '附加字段',
|
|
125
|
+
Name: 'Options.Extra',
|
|
126
|
+
Options: {
|
|
127
|
+
Columns: [
|
|
128
|
+
{
|
|
129
|
+
Label: '值范围',
|
|
130
|
+
Name: 'Value',
|
|
131
|
+
Type: 'Labels',
|
|
132
|
+
Options: {
|
|
133
|
+
Batch: true,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
Label: '不在其中时',
|
|
138
|
+
Type: 'Boolean',
|
|
139
|
+
Name: 'WhenNotIn',
|
|
140
|
+
Default: false,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
Label: '字段',
|
|
144
|
+
Name: 'List',
|
|
145
|
+
Type: 'FieldList',
|
|
146
|
+
Options: {
|
|
147
|
+
Columns: [
|
|
148
|
+
{
|
|
149
|
+
Label: '#',
|
|
150
|
+
Name: 'Index',
|
|
151
|
+
sortable: true,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
Label: '名称',
|
|
155
|
+
Name: 'Name',
|
|
156
|
+
style: 'max-width: 200px;',
|
|
157
|
+
sortable: true,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
Label: '标题',
|
|
161
|
+
Name: 'Label',
|
|
162
|
+
style: 'max-width: 200px;',
|
|
163
|
+
sortable: true,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
Description: '',
|
|
173
|
+
},
|
|
174
|
+
data() {
|
|
175
|
+
return {
|
|
176
|
+
localData: 0,
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
watch: {
|
|
180
|
+
fieldData() {
|
|
181
|
+
this.localData = this.fieldData;
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
created() {
|
|
185
|
+
this.localData = this.fieldData;
|
|
186
|
+
},
|
|
187
|
+
computed: {
|
|
188
|
+
maxlength() {
|
|
189
|
+
if (this.Field && this.Field.Options && this.Field.Options.MaxLength) {
|
|
190
|
+
return this.Field.Options.MaxLength;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return '';
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
methods: {
|
|
197
|
+
valueChanged(d) {
|
|
198
|
+
if (!d) return;
|
|
199
|
+
|
|
200
|
+
if (!Number(d) && Number(d) !== 0) return;
|
|
201
|
+
|
|
202
|
+
let v = d;
|
|
203
|
+
if (typeof this.Field.MinValue !== 'undefined' && Number(this.Field.MinValue) > v) {
|
|
204
|
+
v = Number(this.Field.MinValue);
|
|
205
|
+
}
|
|
206
|
+
if (typeof this.Field.MaxValue !== 'undefined' && Number(this.Field.MaxValue) < v) {
|
|
207
|
+
v = Number(this.Field.MaxValue);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.localData = v;
|
|
211
|
+
this.fieldData = v;
|
|
212
|
+
|
|
213
|
+
this.$emit('input');
|
|
214
|
+
},
|
|
215
|
+
initExtra() {
|
|
216
|
+
if (
|
|
217
|
+
this.Field
|
|
218
|
+
&& this.Field.Options
|
|
219
|
+
&& this.Field.Options.Extra
|
|
220
|
+
&& this.Field.Options.Extra.length > 0
|
|
221
|
+
&& this.fieldData
|
|
222
|
+
) {
|
|
223
|
+
const extraList = [];
|
|
224
|
+
const dataValue = this.fieldData ? this.fieldData.toString() : '';
|
|
225
|
+
for (let i = 0; i < this.Field.Options.Extra.length; i += 1) {
|
|
226
|
+
const extra = this.Field.Options.Extra[i];
|
|
227
|
+
|
|
228
|
+
if (extra.Value && extra.Value.length > 0) {
|
|
229
|
+
const hasIndex = extra.Value.indexOf(dataValue);
|
|
230
|
+
if ((extra.WhenNotIn && hasIndex < 0)
|
|
231
|
+
|| (!extra.WhenNotIn && hasIndex >= 0)) {
|
|
232
|
+
for (let j = 0; j < extra.List.length; j += 1) {
|
|
233
|
+
const fld = extra.List[j];
|
|
234
|
+
// if (extraList.findIndex(f => f.Name === fld.Name && f.Label === fld.Label) < 0) {
|
|
235
|
+
extraList.push(fld);
|
|
236
|
+
// }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return extraList;
|
|
242
|
+
}
|
|
243
|
+
return [];
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="simple-field input-field-password row items-center no-wrap">
|
|
3
|
+
<q-input
|
|
4
|
+
v-model="fieldData"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
hide-bottom-space
|
|
7
|
+
:readonly="Field.ReadOnly"
|
|
8
|
+
:type="isPwd ? 'password' : 'text'"
|
|
9
|
+
:autocomplete="(Field.Options && Field.Options.autocomplete) ? '' : 'new-password'"
|
|
10
|
+
@input="$emit('input')"
|
|
11
|
+
:ref="`input_field_validator_${Field.Name || Field.Label}`"
|
|
12
|
+
:maxlength="maxlength"
|
|
13
|
+
>
|
|
14
|
+
<template v-slot:before>
|
|
15
|
+
<span
|
|
16
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
17
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
18
|
+
v-if="typeof Field.Label !== 'undefined'">
|
|
19
|
+
<q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
|
|
20
|
+
{{Field.Label || ''}}
|
|
21
|
+
<span v-if="Field.Required" class="required-mark">*</span>
|
|
22
|
+
</span>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<template v-slot:append>
|
|
26
|
+
<e-icon
|
|
27
|
+
:name="isPwd ? 'visibility_off' : 'visibility'"
|
|
28
|
+
class="cursor-pointer"
|
|
29
|
+
@click="isPwd = !isPwd"
|
|
30
|
+
/>
|
|
31
|
+
</template>
|
|
32
|
+
</q-input>
|
|
33
|
+
<slot name="warning"></slot>
|
|
34
|
+
</span>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { defineComponent } from 'vue';
|
|
39
|
+
import mixins from 'free-fe-mixins';
|
|
40
|
+
|
|
41
|
+
export default defineComponent({
|
|
42
|
+
name: 'InputFieldPassword',
|
|
43
|
+
mixins: [mixins.InputFieldMixin],
|
|
44
|
+
fieldInfo: {
|
|
45
|
+
Category: 'Simple',
|
|
46
|
+
Label: '密码',
|
|
47
|
+
Value: 'Password',
|
|
48
|
+
Description: '',
|
|
49
|
+
Extra: [
|
|
50
|
+
{
|
|
51
|
+
Type: 'Boolean',
|
|
52
|
+
Label: '自动填入',
|
|
53
|
+
Name: 'Options.autocomplete',
|
|
54
|
+
Default: 'false',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
Type: 'Number',
|
|
58
|
+
Label: '最大长度',
|
|
59
|
+
Name: 'Options.MaxLength',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
isPwd: true,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
computed: {
|
|
69
|
+
maxlength() {
|
|
70
|
+
if (this.Field && this.Field.Options
|
|
71
|
+
&& this.Field.Options.MaxLength) {
|
|
72
|
+
return this.Field.Options.MaxLength;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return '';
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="input-field-permission">
|
|
3
|
+
<slot name="warning"></slot>
|
|
4
|
+
<div class="buttons relative-position" v-if="Field && Field.ShowButtons">
|
|
5
|
+
<span class="q-ml-lg select-all-btn">
|
|
6
|
+
<q-btn round icon="check" @click="fieldData = Object.assign({},serviceList)"></q-btn>
|
|
7
|
+
</span>
|
|
8
|
+
<span class="q-ml-md clear-btn">
|
|
9
|
+
<q-btn round icon="clear" @click="fieldData = {}"></q-btn>
|
|
10
|
+
</span>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="roles relative-position row items-center">
|
|
13
|
+
<q-radio
|
|
14
|
+
class="role"
|
|
15
|
+
v-model="currentRole"
|
|
16
|
+
v-for="(r, idx) in (Field && Field.Roles) || []"
|
|
17
|
+
:key="idx"
|
|
18
|
+
:val="r.Name"
|
|
19
|
+
:label="r.Name || idx"
|
|
20
|
+
@input="fieldData = r.Permission || {};$emit('input')"/>
|
|
21
|
+
</div>
|
|
22
|
+
<permission-editor
|
|
23
|
+
v-if="Field && !Field.HideEditor"
|
|
24
|
+
class="permission-editor"
|
|
25
|
+
:Permission="fieldData"
|
|
26
|
+
:Service="serviceList"
|
|
27
|
+
:readonly="Field.ReadOnly"
|
|
28
|
+
@changed="permissionChanged"
|
|
29
|
+
:noDataScope="Field.NoDataScope"
|
|
30
|
+
></permission-editor>
|
|
31
|
+
</span>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { defineComponent } from 'vue';
|
|
36
|
+
import mixins from 'free-fe-mixins';
|
|
37
|
+
import PermissionEditor from './PermissionEditor';
|
|
38
|
+
|
|
39
|
+
export default defineComponent({
|
|
40
|
+
name: 'InputFieldPermission',
|
|
41
|
+
mixins: [mixins.InputFieldMixin],
|
|
42
|
+
emits:['input'],
|
|
43
|
+
fieldInfo: {
|
|
44
|
+
Category: 'Advanced',
|
|
45
|
+
Label: '权限编辑器',
|
|
46
|
+
Value: 'Permission',
|
|
47
|
+
Description: '',
|
|
48
|
+
},
|
|
49
|
+
components: { PermissionEditor },
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
serviceList: {},
|
|
53
|
+
currentRole: null
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
created() {
|
|
57
|
+
// get all service list
|
|
58
|
+
if (this.Field.Type === 'Permission' && !!this.Field.ServiceList) {
|
|
59
|
+
this.getRequest(this.Field.ServiceList).then((d) => {
|
|
60
|
+
if (d && d.msg === 'OK') {
|
|
61
|
+
this.serviceList = d.data;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
permissionChanged(v) {
|
|
68
|
+
if (!v && this.data) {
|
|
69
|
+
this.data[this.Field.Name] = {};
|
|
70
|
+
} else if (v) {
|
|
71
|
+
this.data[this.Field.Name] = v;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.$emit('input');
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
</script>
|
|
79
|
+
<style lang="sass" scoped>
|
|
80
|
+
.input-field-permission
|
|
81
|
+
.buttons
|
|
82
|
+
height: 48px
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-card dense flat v-if="Service" class="input-field-permission-editor">
|
|
3
|
+
<q-card-section
|
|
4
|
+
v-if="Service.Title"
|
|
5
|
+
class="input-field-permission-title q-pa-none no-wrap"
|
|
6
|
+
:class="!!Service.Scope && Service.Scope.length > 0 && !readonly
|
|
7
|
+
? 'with-scope' : 'without-scope'">
|
|
8
|
+
<q-checkbox v-model="hasThis" :readonly="readonly">
|
|
9
|
+
<div class="row no-wrap">
|
|
10
|
+
<span class="step-number-icon-wrapper" v-if="Step">
|
|
11
|
+
<span class="step-number-icon">{{Step}}</span>
|
|
12
|
+
</span>
|
|
13
|
+
<span class="step-title no-wrap" style="white-space: nowrap; overflow: hidden;">
|
|
14
|
+
{{Service.Title}}
|
|
15
|
+
<span v-if="Code" class="permission-code">({{Code}})</span>
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
</q-checkbox>
|
|
19
|
+
<div v-if="!noDataScope && !!Service.Scope && Service.Scope.length > 0 && !readonly"
|
|
20
|
+
class="data-scope">
|
|
21
|
+
<free-field
|
|
22
|
+
v-for="(scope, index) in Service.Scope"
|
|
23
|
+
:key="index"
|
|
24
|
+
:Field="{
|
|
25
|
+
Type: 'Select',
|
|
26
|
+
Label: scope.Label,
|
|
27
|
+
Name: `Scope.${scope.Field}`,
|
|
28
|
+
Options: scope.Options || [],
|
|
29
|
+
}"
|
|
30
|
+
:values="data"
|
|
31
|
+
@input="scopeChanged"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</q-card-section>
|
|
35
|
+
|
|
36
|
+
<q-card-section v-if="childrenNormalService.length" class="permission-field-children">
|
|
37
|
+
<permission-editor
|
|
38
|
+
v-for="(service, index) in childrenNormalService"
|
|
39
|
+
:key="index"
|
|
40
|
+
:Service="Service[service]"
|
|
41
|
+
:Code="service"
|
|
42
|
+
:readonly="readonly"
|
|
43
|
+
:Permission="permissionData(service)"
|
|
44
|
+
@changed="childUpdated($event, service)"
|
|
45
|
+
:noDataScope="noDataScope"
|
|
46
|
+
></permission-editor>
|
|
47
|
+
</q-card-section>
|
|
48
|
+
|
|
49
|
+
<div v-if="childrenStepService.length" class="permission-field-steps-label">步骤:</div>
|
|
50
|
+
<q-card-section v-if="childrenStepService.length"
|
|
51
|
+
horizontal class="permission-field-steps">
|
|
52
|
+
<permission-editor
|
|
53
|
+
v-for="(service, index) in childrenStepService"
|
|
54
|
+
:key="index"
|
|
55
|
+
:Step="service"
|
|
56
|
+
:Service="Service[service]"
|
|
57
|
+
style="border: 1px solid grey;"
|
|
58
|
+
:Permission="permissionData(service)"
|
|
59
|
+
:readonly="readonly"
|
|
60
|
+
@changed="childUpdated($event, service)"
|
|
61
|
+
:noDataScope="noDataScope"
|
|
62
|
+
></permission-editor>
|
|
63
|
+
</q-card-section>
|
|
64
|
+
</q-card>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import { defineComponent } from 'vue';
|
|
69
|
+
// import mixins from 'free-fe-mixins';
|
|
70
|
+
|
|
71
|
+
export default defineComponent({
|
|
72
|
+
name: 'PermissionEditor',
|
|
73
|
+
// mixins: [mixins.InputFieldMixin],
|
|
74
|
+
emits:['changed'],
|
|
75
|
+
components: {},
|
|
76
|
+
props: {
|
|
77
|
+
Code: { type: String, default: '' },
|
|
78
|
+
Service: { type: Object },
|
|
79
|
+
Permission: { type: Object },
|
|
80
|
+
Step: { type: String, default: '' },
|
|
81
|
+
readonly: { type: Boolean, default: false },
|
|
82
|
+
noDataScope: { type: Boolean, default: false },
|
|
83
|
+
},
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
data: undefined,
|
|
87
|
+
hasThis: false,
|
|
88
|
+
permScope: {},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
watch: {
|
|
92
|
+
data() {
|
|
93
|
+
this.hasThis = !!this.data;
|
|
94
|
+
},
|
|
95
|
+
hasThis() {
|
|
96
|
+
if (this.hasThis) {
|
|
97
|
+
// checked from unchecked
|
|
98
|
+
this.data = this.data || {};
|
|
99
|
+
|
|
100
|
+
this.$emit('changed', this.data);
|
|
101
|
+
} else {
|
|
102
|
+
// unchecked from checked
|
|
103
|
+
this.data = undefined;
|
|
104
|
+
this.$emit('changed', this.data);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
Permission() {
|
|
108
|
+
this.data = this.Permission;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
computed: {
|
|
112
|
+
permissionData() {
|
|
113
|
+
return (service) => (this.data ? this.data[service] : undefined);
|
|
114
|
+
},
|
|
115
|
+
childrenService() {
|
|
116
|
+
if (!this.Service) return [];
|
|
117
|
+
const children = [];
|
|
118
|
+
|
|
119
|
+
for (let i = 0; i < Object.keys(this.Service).length; i += 1) {
|
|
120
|
+
const sk = Object.keys(this.Service)[i];
|
|
121
|
+
const service = this.Service[sk];
|
|
122
|
+
|
|
123
|
+
if (
|
|
124
|
+
typeof service === 'object'
|
|
125
|
+
&& !Array.isArray(service)
|
|
126
|
+
&& ['scope'].indexOf(service) < 0
|
|
127
|
+
) {
|
|
128
|
+
children.push({ Name: sk, Index: this.Service[sk].Index || 0 });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return children.sort(
|
|
132
|
+
(a, b) => (a ? a.Index : 0) - (b ? b.Index : 0),
|
|
133
|
+
).map((cdn) => cdn.Name);
|
|
134
|
+
},
|
|
135
|
+
childrenStepService() {
|
|
136
|
+
return this.childrenService.filter((s) => Number(s));
|
|
137
|
+
},
|
|
138
|
+
childrenNormalService() {
|
|
139
|
+
return this.childrenService.filter((s) => !Number(s));
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
created() {
|
|
143
|
+
this.data = this.Permission;
|
|
144
|
+
},
|
|
145
|
+
methods: {
|
|
146
|
+
childUpdated(v, f) {
|
|
147
|
+
if (!v && this.data && this.data[f]) {
|
|
148
|
+
// this.$set(this.data, f, undefined);
|
|
149
|
+
this.data[f] = undefined;
|
|
150
|
+
} else if (v) {
|
|
151
|
+
this.data = this.data || {};
|
|
152
|
+
// this.$set(this.data, f, v);
|
|
153
|
+
this.data[f] = v;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.$emit('changed', this.data);
|
|
157
|
+
},
|
|
158
|
+
scopeChanged() {
|
|
159
|
+
this.$emit('changed', this.data);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
</script>
|
|
164
|
+
<style lang="sass" scoped>
|
|
165
|
+
.input-field-permission-editor
|
|
166
|
+
font-size: 12px
|
|
167
|
+
padding: 4px
|
|
168
|
+
.input-field-permission-title
|
|
169
|
+
&.without-scope
|
|
170
|
+
height: 35px
|
|
171
|
+
.data-scope
|
|
172
|
+
margin-left: 32px
|
|
173
|
+
.step-number-icon-wrapper
|
|
174
|
+
border-radius: 50%
|
|
175
|
+
border: 1px solid $grey-7
|
|
176
|
+
height: 20px
|
|
177
|
+
width: 20px
|
|
178
|
+
display: inline-block
|
|
179
|
+
vertical-align: top
|
|
180
|
+
padding: 0
|
|
181
|
+
margin: 0
|
|
182
|
+
margin-right: 4px
|
|
183
|
+
.step-number-icon
|
|
184
|
+
display: block
|
|
185
|
+
height: 20px
|
|
186
|
+
line-height: 20px
|
|
187
|
+
text-align: center
|
|
188
|
+
.permission-field
|
|
189
|
+
&-steps
|
|
190
|
+
margin-left: 32px
|
|
191
|
+
&>.input-field-permission-editor
|
|
192
|
+
min-height: 180px
|
|
193
|
+
min-width: 128px
|
|
194
|
+
&-label
|
|
195
|
+
margin-left: 32px
|
|
196
|
+
&-children
|
|
197
|
+
padding: 0
|
|
198
|
+
margin-left: 16px
|
|
199
|
+
</style>
|
|
200
|
+
|
|
201
|
+
<style lang="sass">
|
|
202
|
+
.input-field-permission-editor
|
|
203
|
+
.permission-field-steps.q-card__section
|
|
204
|
+
flex-wrap: wrap !important
|
|
205
|
+
</style>
|