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,162 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`input-field-query-filters columns full-width full-height ${dense ? 'dense' : ''}`">
|
|
3
|
+
<div class="row col items-center justify-start full-width">
|
|
4
|
+
<free-field
|
|
5
|
+
v-for="(field, index) in localFields"
|
|
6
|
+
:key="index"
|
|
7
|
+
:Field="field"
|
|
8
|
+
:values="query"
|
|
9
|
+
noExtra
|
|
10
|
+
noWarning
|
|
11
|
+
noTips
|
|
12
|
+
@input="queryChanged = true"
|
|
13
|
+
></free-field>
|
|
14
|
+
|
|
15
|
+
<free-field
|
|
16
|
+
v-if="hasKw && dense"
|
|
17
|
+
:Field="{
|
|
18
|
+
Type: 'String',
|
|
19
|
+
Name: 'kw',
|
|
20
|
+
Placeholder: `请输入 [${(kwFields && kwFields.length) ? kwFields.join('、') : ''}] 关键字进行查询`
|
|
21
|
+
}"
|
|
22
|
+
:values="query"
|
|
23
|
+
@input="queryChanged = true"
|
|
24
|
+
class="keyword"
|
|
25
|
+
@keydown.enter="search"
|
|
26
|
+
></free-field>
|
|
27
|
+
|
|
28
|
+
<q-space v-if="!hasKw || dense"></q-space>
|
|
29
|
+
<div class="q-ma-xs query-btns" v-if="!hasKw || dense">
|
|
30
|
+
<q-btn class="clear-btn" icon="refresh" label="清空" @click="clear"></q-btn>
|
|
31
|
+
<q-btn class="query-btn q-ma-xs" icon="search" label="查询" @click="search"></q-btn>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="row col items-center full-width" v-if="hasKw && !dense">
|
|
35
|
+
<free-field
|
|
36
|
+
:Field="{
|
|
37
|
+
Type: 'String',
|
|
38
|
+
Label: '关键字',
|
|
39
|
+
Name: 'kw',
|
|
40
|
+
Placeholder: `请输入 [${(kwFields && kwFields.length) ? kwFields.join('、') : ''}] 进行查询`
|
|
41
|
+
}"
|
|
42
|
+
:values="query"
|
|
43
|
+
@input="queryChanged = true"
|
|
44
|
+
class="keyword"
|
|
45
|
+
@keydown.enter="search"
|
|
46
|
+
></free-field>
|
|
47
|
+
<q-space></q-space>
|
|
48
|
+
<div class="q-ma-xs query-btns">
|
|
49
|
+
<q-btn
|
|
50
|
+
v-if="canExport"
|
|
51
|
+
class="export-btn"
|
|
52
|
+
icon="fa fa-list"
|
|
53
|
+
label="导出"
|
|
54
|
+
@click="$emit('export')"
|
|
55
|
+
/>
|
|
56
|
+
<q-btn class="clear-btn" :icon="clearIcon" label="清空" @click="clear"></q-btn>
|
|
57
|
+
<q-btn class="query-btn q-ma-xs" :icon="searchIcon" label="查询" @click="search"></q-btn>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script>
|
|
64
|
+
import { defineComponent } from 'vue';
|
|
65
|
+
import mixins from 'free-fe-mixins';
|
|
66
|
+
|
|
67
|
+
export default defineComponent({
|
|
68
|
+
name: 'InputFieldQueryFilters',
|
|
69
|
+
mixins: [mixins.InputFieldMixin],
|
|
70
|
+
emits:['search', 'export'],
|
|
71
|
+
fieldInfo: {
|
|
72
|
+
Category: 'Advanced',
|
|
73
|
+
Label: '筛选条件',
|
|
74
|
+
Value: 'QueryFilters',
|
|
75
|
+
Description: '',
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
dense: { type: Boolean, default: false },
|
|
79
|
+
canExport: { type: Boolean, default: false },
|
|
80
|
+
queryData: { type: Object, default: () => ({}) },
|
|
81
|
+
searchIcon: { type: String, default: 'search' },
|
|
82
|
+
clearIcon: { type: String, default: 'refresh' },
|
|
83
|
+
},
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
query: {},
|
|
87
|
+
queryChanged: false,
|
|
88
|
+
hasKw: false,
|
|
89
|
+
kwFields: [],
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
localFields() {
|
|
94
|
+
const fList = [];
|
|
95
|
+
let hasKw = false;
|
|
96
|
+
const kwFields = [];
|
|
97
|
+
if (this.fieldData) {
|
|
98
|
+
this.fieldData.forEach((fd) => {
|
|
99
|
+
if (
|
|
100
|
+
['String', 'Text', 'Rich', 'Customize', 'Labels', 'Static'].indexOf(
|
|
101
|
+
fd.Type,
|
|
102
|
+
) >= 0
|
|
103
|
+
) {
|
|
104
|
+
if (!fd.Info || !fd.Info.Separate) {
|
|
105
|
+
hasKw = true;
|
|
106
|
+
if (fd.Label) {
|
|
107
|
+
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
108
|
+
kwFields.push(fd.Label);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
// separate string field as selection
|
|
112
|
+
// TODO: could be other types??
|
|
113
|
+
fd.Type = 'Select';
|
|
114
|
+
if (this.dense) {
|
|
115
|
+
delete fd.Label;
|
|
116
|
+
}
|
|
117
|
+
fList.push(fd);
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
if (this.dense) {
|
|
121
|
+
delete fd.Label;
|
|
122
|
+
}
|
|
123
|
+
fList.push(fd);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
129
|
+
this.hasKw = hasKw;
|
|
130
|
+
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
131
|
+
this.kwFields = kwFields;
|
|
132
|
+
|
|
133
|
+
return fList;
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
watch: {
|
|
137
|
+
queryData() {
|
|
138
|
+
this.query = this.queryData;
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
created() {
|
|
142
|
+
if (this.queryData && Object.keys(this.queryData).length > 0) {
|
|
143
|
+
this.query = this.queryData;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
methods: {
|
|
147
|
+
search() {
|
|
148
|
+
if (this.queryChanged) {
|
|
149
|
+
this.$emit('search', this.query);
|
|
150
|
+
this.queryChanged = false;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
clear() {
|
|
154
|
+
if (Object.keys(this.query).length) {
|
|
155
|
+
this.query = {};
|
|
156
|
+
this.$emit('search', {});
|
|
157
|
+
this.queryChanged = false;
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`input-field-radio-list relative-position ${
|
|
3
|
+
this.hasError ? 'input-field--error' : ''}`">
|
|
4
|
+
<slot name="warning"></slot>
|
|
5
|
+
<q-list>
|
|
6
|
+
<q-item
|
|
7
|
+
tag="label"
|
|
8
|
+
:class="`items-center ${(oIndex % 2) ? 'zebra-odd' : 'zebra-even'}`"
|
|
9
|
+
v-ripple
|
|
10
|
+
v-for="(oValue, oIndex) in Field.Options"
|
|
11
|
+
:key="oIndex"
|
|
12
|
+
>
|
|
13
|
+
<q-item-section
|
|
14
|
+
class="icon-section"
|
|
15
|
+
avatar
|
|
16
|
+
top
|
|
17
|
+
v-if="oValue.Image"
|
|
18
|
+
>
|
|
19
|
+
<e-icon
|
|
20
|
+
:relative="!!oValue.relative"
|
|
21
|
+
:name="oValue.Image.id || oValue.Image"
|
|
22
|
+
class="icon"
|
|
23
|
+
></e-icon>
|
|
24
|
+
</q-item-section>
|
|
25
|
+
<q-item-section class="label-section">
|
|
26
|
+
<q-item-label class="label ellipsis">{{oValue.Label}}</q-item-label>
|
|
27
|
+
<q-item-label
|
|
28
|
+
caption
|
|
29
|
+
class="description ellipsis-3-lines"
|
|
30
|
+
>{{oValue.Description}}</q-item-label>
|
|
31
|
+
</q-item-section>
|
|
32
|
+
<q-item-section
|
|
33
|
+
class="radio-section"
|
|
34
|
+
avatar
|
|
35
|
+
top
|
|
36
|
+
>
|
|
37
|
+
<q-radio
|
|
38
|
+
class="radio"
|
|
39
|
+
v-model="data[Field.Name]"
|
|
40
|
+
@input="validate(); $emit('input')"
|
|
41
|
+
:val="oValue.Value"
|
|
42
|
+
:disable="Field.ReadOnly"
|
|
43
|
+
/>
|
|
44
|
+
</q-item-section>
|
|
45
|
+
</q-item>
|
|
46
|
+
</q-list>
|
|
47
|
+
<div
|
|
48
|
+
class="input-field--error-tag"
|
|
49
|
+
v-if="hasError"
|
|
50
|
+
>
|
|
51
|
+
<e-icon name="error"></e-icon>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import { defineComponent } from 'vue';
|
|
58
|
+
import mixins from 'free-fe-mixins';
|
|
59
|
+
|
|
60
|
+
export default defineComponent({
|
|
61
|
+
name: 'InputFieldRadioList',
|
|
62
|
+
mixins: [mixins.InputFieldMixin],
|
|
63
|
+
fieldInfo: {
|
|
64
|
+
Category: 'Simple',
|
|
65
|
+
Label: '展开单选',
|
|
66
|
+
Value: 'RadioList',
|
|
67
|
+
Description: '',
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
validate() {
|
|
71
|
+
if (!this.data || !this.Field || !this.Field.Name) {
|
|
72
|
+
this.hasError = false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.hasError = typeof this.data[this.Field.Name] === 'undefined';
|
|
77
|
+
return !this.hasError;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-field-rich row no-wrap">
|
|
3
|
+
<span
|
|
4
|
+
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
5
|
+
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
|
|
6
|
+
v-if="typeof Field.Label !== 'undefined'"
|
|
7
|
+
>
|
|
8
|
+
<q-tooltip
|
|
9
|
+
v-if="Field.Description"
|
|
10
|
+
anchor="top right"
|
|
11
|
+
>{{Field.Description}}</q-tooltip>
|
|
12
|
+
{{Field.Label || ''}}
|
|
13
|
+
<span
|
|
14
|
+
v-if="Field.Required"
|
|
15
|
+
class="required-mark"
|
|
16
|
+
>*</span>
|
|
17
|
+
</span>
|
|
18
|
+
<span class="content relative-position fit" :class="isValid ? '' : 'input-field--error'">
|
|
19
|
+
<slot name="warning"></slot>
|
|
20
|
+
|
|
21
|
+
<div class="input-field--error-tag" v-if="!isValid">
|
|
22
|
+
<e-icon name="error"></e-icon>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<span
|
|
26
|
+
v-if="Field.ReadOnly"
|
|
27
|
+
class="col readonly"
|
|
28
|
+
ref="readonlyContent"
|
|
29
|
+
></span>
|
|
30
|
+
<tiny
|
|
31
|
+
v-if="!Field.ReadOnly"
|
|
32
|
+
ref="tiny"
|
|
33
|
+
api-key="wh7g3etkwrso25e0wcpqrx8uvoa51toag3j92mllkajtg1xb"
|
|
34
|
+
tinymce-script-src="tiny/tiny_bk.js"
|
|
35
|
+
:init="{
|
|
36
|
+
language_url: 'tiny/langs/zh_cn.js',
|
|
37
|
+
language: 'zh_cn',
|
|
38
|
+
plugins: Field.ReadOnly ? [] : this.plugins,
|
|
39
|
+
menubar: Field.ReadOnly ? [] : this.menubar,
|
|
40
|
+
toolbar: Field.ReadOnly ? '' : this.toolbar.join(' '),
|
|
41
|
+
toolbar_mode: 'wrap',
|
|
42
|
+
importcss_append: true,
|
|
43
|
+
height: 500,
|
|
44
|
+
image_caption: true,
|
|
45
|
+
quickbars_selection_toolbar: Field.ReadOnly
|
|
46
|
+
? '' : this.quickbars_selection_toolbar.join(' '),
|
|
47
|
+
contextmenu: Field.ReadOnly ? '' : this.contextmenu.join(' '),
|
|
48
|
+
extended_valid_elements:'efield',
|
|
49
|
+
setup: tinySetup,
|
|
50
|
+
default_link_target: (Field && Field.Options && Field.Options.LinkTarget) || '_blank',
|
|
51
|
+
}"
|
|
52
|
+
initial-value
|
|
53
|
+
model-events
|
|
54
|
+
plugins
|
|
55
|
+
:disabled="Field.ReadOnly"
|
|
56
|
+
toolbar
|
|
57
|
+
value
|
|
58
|
+
v-model="fieldData"
|
|
59
|
+
@onChange="validate();$emit('input')"
|
|
60
|
+
/>
|
|
61
|
+
</span>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import { defineComponent } from 'vue';
|
|
67
|
+
import mixins from 'free-fe-mixins';
|
|
68
|
+
import tiny from '@tinymce/tinymce-vue';
|
|
69
|
+
|
|
70
|
+
function fileSizeStrToNumber(s) {
|
|
71
|
+
if (!s) return undefined;
|
|
72
|
+
|
|
73
|
+
const sizeMatch = s.match(/^([0-9]*)(k|m|g*)(b*)/);
|
|
74
|
+
|
|
75
|
+
if (sizeMatch) {
|
|
76
|
+
// eslint-disable-next-line no-unused-vars
|
|
77
|
+
// const [tmp, num, unit] = sizeMatch;
|
|
78
|
+
const num = sizeMatch[1];
|
|
79
|
+
const unit = sizeMatch[2];
|
|
80
|
+
if (!num || !Number(num)) return '';
|
|
81
|
+
|
|
82
|
+
let multi = 1;
|
|
83
|
+
switch (unit) {
|
|
84
|
+
case 'k':
|
|
85
|
+
multi = 1024;
|
|
86
|
+
break;
|
|
87
|
+
case 'm':
|
|
88
|
+
multi = 1024 * 1024;
|
|
89
|
+
break;
|
|
90
|
+
case 'g':
|
|
91
|
+
multi = 1024 * 1024 * 1024;
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
multi = 1024;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Number(num) * multi;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default defineComponent({
|
|
105
|
+
name: 'InputFieldRich',
|
|
106
|
+
mixins: [mixins.InputFieldMixin],
|
|
107
|
+
fieldInfo: {
|
|
108
|
+
Category: 'Advanced',
|
|
109
|
+
Label: '所见即所得',
|
|
110
|
+
Value: 'Rich',
|
|
111
|
+
Description: '',
|
|
112
|
+
Extra: [
|
|
113
|
+
{
|
|
114
|
+
Type: 'Number',
|
|
115
|
+
Label: '最大长度',
|
|
116
|
+
Name: 'Options.MaxLength',
|
|
117
|
+
Default: '1000',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
Type: 'Number',
|
|
121
|
+
Label: '最大内容大小',
|
|
122
|
+
Name: 'Options.MaxSize',
|
|
123
|
+
Default: '5m',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
Type: 'Select',
|
|
127
|
+
Name: 'Options.LinkTarget',
|
|
128
|
+
Label: '默认链接打开方式',
|
|
129
|
+
Default: '_blank',
|
|
130
|
+
Options: [
|
|
131
|
+
{
|
|
132
|
+
Label: '新窗口',
|
|
133
|
+
Value: '_blank',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
Label: '当前窗口',
|
|
137
|
+
Value: '_self',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
components: {
|
|
144
|
+
tiny,
|
|
145
|
+
},
|
|
146
|
+
props: {
|
|
147
|
+
enableField: { type: Boolean, default: false },
|
|
148
|
+
},
|
|
149
|
+
data() {
|
|
150
|
+
return {
|
|
151
|
+
isValid: true,
|
|
152
|
+
plugins: [
|
|
153
|
+
'print',
|
|
154
|
+
// 'preview',
|
|
155
|
+
'paste',
|
|
156
|
+
// 'importcss',
|
|
157
|
+
// 'searchreplace',
|
|
158
|
+
// 'autolink',
|
|
159
|
+
// 'autosave',
|
|
160
|
+
// 'save',
|
|
161
|
+
// 'directionality',
|
|
162
|
+
'code',
|
|
163
|
+
// 'visualblocks',
|
|
164
|
+
// 'visualchars',
|
|
165
|
+
'fullscreen',
|
|
166
|
+
'image',
|
|
167
|
+
'link',
|
|
168
|
+
'media',
|
|
169
|
+
// 'template',
|
|
170
|
+
// 'codesample',
|
|
171
|
+
'table',
|
|
172
|
+
// 'charmap',
|
|
173
|
+
'hr',
|
|
174
|
+
// 'pagebreak',
|
|
175
|
+
// 'nonbreaking',
|
|
176
|
+
// 'anchor',
|
|
177
|
+
// 'toc',
|
|
178
|
+
// 'insertdatetime',
|
|
179
|
+
// 'advlist',
|
|
180
|
+
'lists',
|
|
181
|
+
'wordcount',
|
|
182
|
+
// 'imagetools',
|
|
183
|
+
// 'textpattern',
|
|
184
|
+
// 'noneditable',
|
|
185
|
+
// 'help',
|
|
186
|
+
// 'charmap',
|
|
187
|
+
'quickbars',
|
|
188
|
+
'emoticons',
|
|
189
|
+
],
|
|
190
|
+
menubar: ['insert', 'format', 'table'],
|
|
191
|
+
toolbar: [
|
|
192
|
+
'undo',
|
|
193
|
+
'redo',
|
|
194
|
+
'|',
|
|
195
|
+
'bold',
|
|
196
|
+
'italic',
|
|
197
|
+
'underline',
|
|
198
|
+
'strikethrough',
|
|
199
|
+
'|',
|
|
200
|
+
// 'fontselect',
|
|
201
|
+
'fontsizeselect',
|
|
202
|
+
'formatselect',
|
|
203
|
+
'|',
|
|
204
|
+
'alignleft',
|
|
205
|
+
'aligncenter',
|
|
206
|
+
'alignright',
|
|
207
|
+
'alignjustify',
|
|
208
|
+
'|',
|
|
209
|
+
'numlist',
|
|
210
|
+
'bullist',
|
|
211
|
+
'|',
|
|
212
|
+
'charmap',
|
|
213
|
+
'emoticons',
|
|
214
|
+
'|',
|
|
215
|
+
'fullscreen',
|
|
216
|
+
'|',
|
|
217
|
+
'insertfile',
|
|
218
|
+
'image',
|
|
219
|
+
'media',
|
|
220
|
+
'link',
|
|
221
|
+
'|',
|
|
222
|
+
'code',
|
|
223
|
+
'insertFieldButton',
|
|
224
|
+
],
|
|
225
|
+
quickbars_selection_toolbar: [
|
|
226
|
+
'bold',
|
|
227
|
+
'italic',
|
|
228
|
+
'|',
|
|
229
|
+
'quicklink',
|
|
230
|
+
'h2',
|
|
231
|
+
'h3',
|
|
232
|
+
'blockquote',
|
|
233
|
+
'quickimage',
|
|
234
|
+
'quicktable',
|
|
235
|
+
'|',
|
|
236
|
+
'insertFieldButton',
|
|
237
|
+
],
|
|
238
|
+
contextmenu: ['link', 'image', 'table'],
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
watch: {
|
|
242
|
+
fieldData() {
|
|
243
|
+
if (this.$refs.readonlyContent && this.Field.ReadOnly && this.fieldData) {
|
|
244
|
+
this.$refs.readonlyContent.innerHTML = this.fieldData;
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
created() {
|
|
249
|
+
if (this.$refs.readonlyContent && this.Field.ReadOnly) {
|
|
250
|
+
this.$refs.readonlyContent.innerHTML = this.fieldData;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this.Field.Warning = this.Field.Warning
|
|
254
|
+
|| `可嵌入图片、视频、超级链接。内容不可超过${(this.Field.Options && this.Field.Options.MaxLength) || 1000}字,内容总大小不可超过${(this.Field.Options && this.Field.Options.MaxSize) || '5m'}。较大图片或视频请使用超链接!`;
|
|
255
|
+
},
|
|
256
|
+
methods: {
|
|
257
|
+
validate() {
|
|
258
|
+
let isValid = true;
|
|
259
|
+
if (this.$refs.tiny) {
|
|
260
|
+
if (this.Field.Required) isValid = !!this.fieldData;
|
|
261
|
+
|
|
262
|
+
const rules = Array.isArray(typeof this.Field.Rules)
|
|
263
|
+
? this.Field.Rules : [this.Field.Rules];
|
|
264
|
+
|
|
265
|
+
for (let i = 0; i < rules.length; i += 1) {
|
|
266
|
+
const r = rules[i];
|
|
267
|
+
|
|
268
|
+
if (typeof r === 'function') {
|
|
269
|
+
isValid = isValid && r(this.fieldData);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
this.isValid = isValid;
|
|
275
|
+
|
|
276
|
+
return isValid;
|
|
277
|
+
},
|
|
278
|
+
tinySetup(editor) {
|
|
279
|
+
if (this.enableField) {
|
|
280
|
+
editor.ui.registry.addButton('insertFieldButton', {
|
|
281
|
+
text: '数据字段',
|
|
282
|
+
tooltip: '插入数据字段',
|
|
283
|
+
onAction() {
|
|
284
|
+
const selectedText = editor.selection.getContent({
|
|
285
|
+
format: 'html',
|
|
286
|
+
});
|
|
287
|
+
editor.insertContent(`<efield>{${selectedText}}</efield>`);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (this.Field && this.Field.Options) {
|
|
293
|
+
if (this.Field.Options.MaxLength) {
|
|
294
|
+
editor.on('keydown', (e) => {
|
|
295
|
+
const allowedKeys = [8, 37, 38, 39, 40, 46];
|
|
296
|
+
if (allowedKeys.indexOf(e.keyCode) >= 0) return true;
|
|
297
|
+
|
|
298
|
+
const selectedText = editor.selection.getContent({
|
|
299
|
+
format: 'text',
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
if (selectedText.length <= 0
|
|
303
|
+
&& editor.getContent({ format: 'text' }).length >= this.Field.Options.MaxLength) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
e.stopPropagation();
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return true;
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
if (this.Field.Options.MaxSize) {
|
|
313
|
+
const maxSize = fileSizeStrToNumber(this.Field.Options.MaxSize);
|
|
314
|
+
|
|
315
|
+
editor.on('keydown', (e) => {
|
|
316
|
+
const allowedKeys = [8, 37, 38, 39, 40, 46];
|
|
317
|
+
if (allowedKeys.indexOf(e.keyCode) >= 0) return true;
|
|
318
|
+
|
|
319
|
+
const selectedText = editor.selection.getContent({
|
|
320
|
+
format: 'text',
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
if (selectedText.length <= 0
|
|
324
|
+
&& editor.getContent({ format: 'html' }).length >= maxSize) {
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
e.stopPropagation();
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return true;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
</script>
|
|
338
|
+
|
|
339
|
+
<style lang="sass">
|
|
340
|
+
// .tox.tox-tinymce
|
|
341
|
+
// z-index: 2000 !important
|
|
342
|
+
.tox-tinymce-aux
|
|
343
|
+
z-index: 6001 !important
|
|
344
|
+
.tox-menu
|
|
345
|
+
z-index: 6002 !important
|
|
346
|
+
|
|
347
|
+
.tox-fullscreen
|
|
348
|
+
z-index: 6000 !important
|
|
349
|
+
.tox-tinymce-aux
|
|
350
|
+
z-index: 6001 !important
|
|
351
|
+
.tox-tiered-menu
|
|
352
|
+
z-index: 6002 !important
|
|
353
|
+
.tox-menu
|
|
354
|
+
z-index: 6002 !important
|
|
355
|
+
// .tox-tinymce-aux
|
|
356
|
+
// z-index: 6001 !important
|
|
357
|
+
|
|
358
|
+
.input-field-rich
|
|
359
|
+
.tox-statusbar__branding
|
|
360
|
+
display: none
|
|
361
|
+
.tox-tinymce
|
|
362
|
+
width: auto
|
|
363
|
+
min-width: 0
|
|
364
|
+
max-width: 100%
|
|
365
|
+
flex: 10000 1 0%
|
|
366
|
+
|
|
367
|
+
.tox-notifications-container,.tox-statusbar__branding
|
|
368
|
+
display: none
|
|
369
|
+
</style>
|