@tongfun/tf-widget 0.1.21 → 0.1.22
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 +49 -49
- package/lib/tf-widget.common.js +547 -503
- package/lib/tf-widget.css +1 -1
- package/lib/tf-widget.umd.js +547 -503
- package/lib/tf-widget.umd.min.js +4 -4
- package/package/svg-icon/index.js +8 -8
- package/package/svg-icon/src/SvgIcon.vue +59 -59
- package/package/t-data-list/index.js +6 -6
- package/package/t-data-list/main.vue +193 -193
- package/package/t-data-list/src/condition-input/basic.vue +31 -31
- package/package/t-data-list/src/condition-input/date.vue +106 -106
- package/package/t-data-list/src/condition-input/index.vue +100 -100
- package/package/t-data-list/src/condition-input/input.vue +31 -31
- package/package/t-data-list/src/condition-input/number.vue +115 -115
- package/package/t-data-list/src/condition-input/select.vue +86 -86
- package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
- package/package/t-data-list/src/js/operatorEnum.js +108 -108
- package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
- package/package/t-data-list/src/js/util.js +34 -34
- package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -93
- package/package/t-data-list/src/pushdown/push-down.vue +158 -158
- package/package/t-data-list/src/t-list-search.vue +36 -36
- package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
- package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
- package/package/t-data-list/src/t-plan/index.vue +195 -195
- package/package/t-data-list/src/t-plan/plan-content.vue +389 -389
- package/package/t-data-list/src/t-table/index.vue +129 -129
- package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
- package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
- package/package/t-data-list/src/t-table/table-group.vue +180 -180
- package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -246
- package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
- package/package/t-data-list/src/t-table/table-records.vue +337 -337
- package/package/t-input/children/address.vue +101 -101
- package/package/t-input/children/basic-display.vue +41 -41
- package/package/t-input/children/basic.vue +253 -253
- package/package/t-input/children/date.vue +89 -89
- package/package/t-input/children/group-components/group-dialog.vue +344 -344
- package/package/t-input/children/group.vue +126 -126
- package/package/t-input/children/input.vue +72 -72
- package/package/t-input/children/number.vue +74 -74
- package/package/t-input/children/select.vue +89 -89
- package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
- package/package/t-input/index.js +7 -7
- package/package/t-input/index.vue +337 -337
- package/package/t-input/tInputCache.js +24 -24
- package/package/tf-icon-picker/README.md +7 -7
- package/package/tf-icon-picker/index.js +8 -8
- package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
- package/package/tf-layout/README.md +115 -115
- package/package/tf-layout/index.js +8 -8
- package/package/tf-layout/src/components/tf-labelbar.vue +394 -394
- package/package/tf-layout/src/components/tf-menu.vue +180 -180
- package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
- package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
- package/package/tf-layout/src/tf-layout.vue +140 -140
- package/package/tf-widget/index.js +8 -8
- package/package/tf-widget/src/assets/common-input.less +10 -10
- package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
- package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
- package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
- package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
- package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
- package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
- package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
- package/package/tf-widget/src/children/date-time.vue +103 -103
- package/package/tf-widget/src/children/date.vue +103 -103
- package/package/tf-widget/src/children/decimal.vue +115 -115
- package/package/tf-widget/src/children/integer.vue +104 -104
- package/package/tf-widget/src/children/property.vue +59 -59
- package/package/tf-widget/src/children/single-line-text.vue +82 -82
- package/package/tf-widget/src/children/small-pictures.vue +223 -223
- package/package/tf-widget/src/children/text-area.vue +74 -74
- package/package/tf-widget/src/children/tf-select.vue +113 -113
- package/package/tf-widget/src/tf-widget.vue +175 -175
- package/package.json +44 -44
- package/src/api/edit.js +97 -97
- package/src/api/file-enclosure.js +26 -26
- package/src/api/push-down.js +19 -19
- package/src/api/table.js +294 -294
- package/src/api/tableV3.js +166 -160
- package/src/assets/images/icons/index.js +9 -9
- package/src/assets/images/icons/svg/add.svg +5 -5
- package/src/assets/images/icons/svg/push-down.svg +1 -1
- package/src/assets/images/icons/svg/remove.svg +1 -1
- package/src/assets/styles/common-table.less +202 -202
- package/src/directives/debounce.js +24 -24
- package/src/index.js +31 -31
- package/src/mixins/t-data-query-mixin.js +290 -290
- package/src/utils/auth.js +22 -22
- package/src/utils/request.js +42 -42
- package/src/utils/stato-anormale.js +59 -59
- package/src/utils/utils.js +109 -109
- package/src/utils/validate.js +84 -84
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const ProxyCreateSingleton = (function () {
|
|
2
|
-
let instance = null
|
|
3
|
-
return function () {
|
|
4
|
-
if (instance) {
|
|
5
|
-
return instance
|
|
6
|
-
}
|
|
7
|
-
instance = new InputData()
|
|
8
|
-
return instance
|
|
9
|
-
}
|
|
10
|
-
})()
|
|
11
|
-
class InputData {
|
|
12
|
-
#cacheData = new Map()
|
|
13
|
-
getCacheData (key) {
|
|
14
|
-
if (key) {
|
|
15
|
-
return this.#cacheData.get(key)
|
|
16
|
-
}
|
|
17
|
-
return this.#cacheData
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
setCacheData (key, value) {
|
|
21
|
-
this.#cacheData.set(key, value)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export default ProxyCreateSingleton
|
|
1
|
+
const ProxyCreateSingleton = (function () {
|
|
2
|
+
let instance = null
|
|
3
|
+
return function () {
|
|
4
|
+
if (instance) {
|
|
5
|
+
return instance
|
|
6
|
+
}
|
|
7
|
+
instance = new InputData()
|
|
8
|
+
return instance
|
|
9
|
+
}
|
|
10
|
+
})()
|
|
11
|
+
class InputData {
|
|
12
|
+
#cacheData = new Map()
|
|
13
|
+
getCacheData (key) {
|
|
14
|
+
if (key) {
|
|
15
|
+
return this.#cacheData.get(key)
|
|
16
|
+
}
|
|
17
|
+
return this.#cacheData
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setCacheData (key, value) {
|
|
21
|
+
this.#cacheData.set(key, value)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export default ProxyCreateSingleton
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# tf-icon-picker
|
|
2
|
-
|
|
3
|
-
1. 参数
|
|
4
|
-
1. width (Number) 选择图标区域宽度,默认值 400。
|
|
5
|
-
2. placement (string) 选择图标展示区域,默认值 'bottom', 可选值: 'top', 'left', 'right', 'bottom'。
|
|
6
|
-
3. hint (string) 展示图标选择标题。
|
|
7
|
-
|
|
1
|
+
# tf-icon-picker
|
|
2
|
+
|
|
3
|
+
1. 参数
|
|
4
|
+
1. width (Number) 选择图标区域宽度,默认值 400。
|
|
5
|
+
2. placement (string) 选择图标展示区域,默认值 'bottom', 可选值: 'top', 'left', 'right', 'bottom'。
|
|
6
|
+
3. hint (string) 展示图标选择标题。
|
|
7
|
+
|
|
8
8
|
2.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import TfIconPicker from './src/tf-icon-picker'
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
TfIconPicker.install = function (Vue) {
|
|
5
|
-
Vue.component(TfIconPicker.name, TfIconPicker)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default TfIconPicker
|
|
1
|
+
import TfIconPicker from './src/tf-icon-picker'
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
TfIconPicker.install = function (Vue) {
|
|
5
|
+
Vue.component(TfIconPicker.name, TfIconPicker)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default TfIconPicker
|
|
@@ -1,266 +1,266 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-popover
|
|
4
|
-
v-model="visible"
|
|
5
|
-
:placement="placement"
|
|
6
|
-
:width="width"
|
|
7
|
-
trigger="manual"
|
|
8
|
-
>
|
|
9
|
-
<div class="content-view">
|
|
10
|
-
<div class="search-box">
|
|
11
|
-
<svg-icon
|
|
12
|
-
v-if="selectIconClass"
|
|
13
|
-
:icon-class="selectIconClass.font_class"
|
|
14
|
-
/>
|
|
15
|
-
<span v-if="selectIconClass">{{ selectIconClass.name }}</span>
|
|
16
|
-
<el-input
|
|
17
|
-
v-model="search"
|
|
18
|
-
size="mini"
|
|
19
|
-
style="width: 50%"
|
|
20
|
-
clearable
|
|
21
|
-
@clear="cleanSearch"
|
|
22
|
-
/>
|
|
23
|
-
<el-button
|
|
24
|
-
size="mini"
|
|
25
|
-
@click="searchInfo"
|
|
26
|
-
>搜索</el-button>
|
|
27
|
-
</div>
|
|
28
|
-
<el-empty
|
|
29
|
-
v-if="!iconList || iconList.length === 0"
|
|
30
|
-
description="暂无数据!"
|
|
31
|
-
style="height: 270px;width: 100%"
|
|
32
|
-
/>
|
|
33
|
-
<div
|
|
34
|
-
v-for="item in iconList"
|
|
35
|
-
:key="item.unicode_decimal"
|
|
36
|
-
class="icon-item"
|
|
37
|
-
@click="selectIcon(item)"
|
|
38
|
-
>
|
|
39
|
-
<el-tooltip
|
|
40
|
-
placement="top"
|
|
41
|
-
>
|
|
42
|
-
<div slot="content">
|
|
43
|
-
<span>图标名称: {{ item.name }}</span>
|
|
44
|
-
<br>
|
|
45
|
-
<br>
|
|
46
|
-
<span>class: {{ item.font_class }}</span>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="icon-box">
|
|
49
|
-
|
|
50
|
-
<svg-icon
|
|
51
|
-
:icon-class="item.font_class"
|
|
52
|
-
/>
|
|
53
|
-
<span :title="item.name">{{ item.name }}</span>
|
|
54
|
-
</div>
|
|
55
|
-
</el-tooltip>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="paging">
|
|
58
|
-
<span>第 {{ pagination + 1 }} 页</span>
|
|
59
|
-
<el-pagination
|
|
60
|
-
small
|
|
61
|
-
background
|
|
62
|
-
layout="total, prev, next"
|
|
63
|
-
:total="total"
|
|
64
|
-
@current-change="handleCurrentChange"
|
|
65
|
-
/>
|
|
66
|
-
|
|
67
|
-
<el-button
|
|
68
|
-
type="info"
|
|
69
|
-
size="mini"
|
|
70
|
-
@click="visible = false"
|
|
71
|
-
>取消</el-button>
|
|
72
|
-
<el-button
|
|
73
|
-
class="button"
|
|
74
|
-
size="mini"
|
|
75
|
-
@click="select"
|
|
76
|
-
>确定</el-button>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<el-button
|
|
80
|
-
slot="reference"
|
|
81
|
-
class="button"
|
|
82
|
-
:size="bottomSize"
|
|
83
|
-
@click="visible = !visible; selectIconClass = null"
|
|
84
|
-
>{{ hint }}</el-button>
|
|
85
|
-
</el-popover>
|
|
86
|
-
</div>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script>
|
|
90
|
-
import axios from 'axios'
|
|
91
|
-
export default {
|
|
92
|
-
name: 'TfIconPicker',
|
|
93
|
-
props: {
|
|
94
|
-
width: {
|
|
95
|
-
default: 400,
|
|
96
|
-
type: Number
|
|
97
|
-
},
|
|
98
|
-
placement: {
|
|
99
|
-
default: 'bottom',
|
|
100
|
-
type: String
|
|
101
|
-
},
|
|
102
|
-
bottomSize: {
|
|
103
|
-
default: 'small',
|
|
104
|
-
type: String
|
|
105
|
-
},
|
|
106
|
-
hint: {
|
|
107
|
-
default: '选择图标',
|
|
108
|
-
type: String
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
data () {
|
|
112
|
-
return {
|
|
113
|
-
glyphsList: null,
|
|
114
|
-
allIconList: null,
|
|
115
|
-
pagination: 0,
|
|
116
|
-
iconList: null,
|
|
117
|
-
total: 0,
|
|
118
|
-
selectIconClass: null,
|
|
119
|
-
visible: false,
|
|
120
|
-
search: null
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
watch: {
|
|
124
|
-
pagination: {
|
|
125
|
-
handler: function (newValue) {
|
|
126
|
-
if (!this.glyphsList) return
|
|
127
|
-
this.iconList = this.allIconList.slice(newValue * 20, (newValue + 1) * 20)
|
|
128
|
-
},
|
|
129
|
-
immediate: true
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
created () {
|
|
133
|
-
axios.get('/icon-list.json').then((res) => {
|
|
134
|
-
if (res.status === 200) {
|
|
135
|
-
const { glyphs: glyphsList } = res.data
|
|
136
|
-
this.glyphsList = glyphsList.sort((a, b) => a.font_class - b.font_class)
|
|
137
|
-
this.allIconList = JSON.parse(JSON.stringify(this.glyphsList))
|
|
138
|
-
this.total = this.allIconList?.length
|
|
139
|
-
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20)
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
},
|
|
143
|
-
methods: {
|
|
144
|
-
handleCurrentChange (val) {
|
|
145
|
-
if (val - 1 > this.total / 20) return
|
|
146
|
-
this.pagination = val - 1
|
|
147
|
-
},
|
|
148
|
-
selectIcon (params) {
|
|
149
|
-
this.selectIconClass = params
|
|
150
|
-
},
|
|
151
|
-
searchInfo () {
|
|
152
|
-
this.pagination = 0
|
|
153
|
-
const glyphs = JSON.parse(JSON.stringify(this.glyphsList))
|
|
154
|
-
const iconArr = []
|
|
155
|
-
glyphs.forEach(item => {
|
|
156
|
-
const str = `${item.font_class}+${item.name}`.toLowerCase()
|
|
157
|
-
if (str.indexOf(this.search.toLowerCase()) !== -1) {
|
|
158
|
-
iconArr.push(item)
|
|
159
|
-
}
|
|
160
|
-
})
|
|
161
|
-
this.allIconList = iconArr
|
|
162
|
-
this.total = this.allIconList.length
|
|
163
|
-
if (iconArr.length > 20) {
|
|
164
|
-
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20).sort((a, b) => a.font_class - b.font_class)
|
|
165
|
-
} else {
|
|
166
|
-
this.iconList = iconArr.sort((a, b) => a.font_class - b.font_class)
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
cleanSearch () {
|
|
170
|
-
this.pagination = 0
|
|
171
|
-
this.allIconList = JSON.parse(JSON.stringify(this.glyphsList))
|
|
172
|
-
this.total = this.allIconList?.length
|
|
173
|
-
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20)
|
|
174
|
-
},
|
|
175
|
-
select () {
|
|
176
|
-
if (this.selectIconClass) {
|
|
177
|
-
this.$emit('selectIcon', JSON.parse(JSON.stringify(this.selectIconClass)))
|
|
178
|
-
} else {
|
|
179
|
-
this.$message.error('未选择图标')
|
|
180
|
-
}
|
|
181
|
-
this.selectIconClass = null
|
|
182
|
-
this.visible = false
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
</script>
|
|
187
|
-
|
|
188
|
-
<style lang="less" scoped>
|
|
189
|
-
.content-view {
|
|
190
|
-
min-height: 300px;
|
|
191
|
-
display: flex;
|
|
192
|
-
justify-content: left;
|
|
193
|
-
align-items: center;
|
|
194
|
-
flex-wrap: wrap;
|
|
195
|
-
align-content: flex-start;
|
|
196
|
-
.search-box {
|
|
197
|
-
width: 100%;
|
|
198
|
-
display: flex;
|
|
199
|
-
justify-content: left;
|
|
200
|
-
align-items: center;
|
|
201
|
-
gap: 0 10px;
|
|
202
|
-
color: red;
|
|
203
|
-
.svg-icon {
|
|
204
|
-
height: 20px;
|
|
205
|
-
width: 20px;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
.icon-item {
|
|
209
|
-
width: 20%;
|
|
210
|
-
height: 60px;
|
|
211
|
-
display: flex;
|
|
212
|
-
margin-top: 10px;
|
|
213
|
-
align-items: center;
|
|
214
|
-
justify-content: center;
|
|
215
|
-
.icon-box {
|
|
216
|
-
box-sizing: border-box;
|
|
217
|
-
padding: 5px 0;
|
|
218
|
-
border-radius: 2px;
|
|
219
|
-
border: 1px solid #eeeeee;
|
|
220
|
-
display: inherit;
|
|
221
|
-
flex-direction: column;
|
|
222
|
-
justify-content: space-between;
|
|
223
|
-
align-items: center;
|
|
224
|
-
width: 60px;
|
|
225
|
-
height: 100%;
|
|
226
|
-
color: #666666;
|
|
227
|
-
&:hover {
|
|
228
|
-
color: #2a90e9;
|
|
229
|
-
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
230
|
-
}
|
|
231
|
-
.svg-icon {
|
|
232
|
-
height: 25px;
|
|
233
|
-
width: 25px;
|
|
234
|
-
}
|
|
235
|
-
span {
|
|
236
|
-
line-height: 1;
|
|
237
|
-
box-sizing: border-box;
|
|
238
|
-
padding: 0 2px;
|
|
239
|
-
text-align: center;
|
|
240
|
-
width: 60px;
|
|
241
|
-
display: inline-block;
|
|
242
|
-
white-space: nowrap;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
text-overflow: ellipsis;
|
|
245
|
-
cursor: pointer;
|
|
246
|
-
font-size: 12px;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
.paging {
|
|
251
|
-
display: flex;
|
|
252
|
-
justify-content: right;
|
|
253
|
-
align-items: center;
|
|
254
|
-
margin-top: 10px;
|
|
255
|
-
height: 20px;
|
|
256
|
-
width: 100%;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
.button {
|
|
260
|
-
opacity: 1;
|
|
261
|
-
background: #0c4c8e;
|
|
262
|
-
border-radius: 2px;
|
|
263
|
-
font-weight: 700;
|
|
264
|
-
color: #FFFFFF;
|
|
265
|
-
}
|
|
266
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-popover
|
|
4
|
+
v-model="visible"
|
|
5
|
+
:placement="placement"
|
|
6
|
+
:width="width"
|
|
7
|
+
trigger="manual"
|
|
8
|
+
>
|
|
9
|
+
<div class="content-view">
|
|
10
|
+
<div class="search-box">
|
|
11
|
+
<svg-icon
|
|
12
|
+
v-if="selectIconClass"
|
|
13
|
+
:icon-class="selectIconClass.font_class"
|
|
14
|
+
/>
|
|
15
|
+
<span v-if="selectIconClass">{{ selectIconClass.name }}</span>
|
|
16
|
+
<el-input
|
|
17
|
+
v-model="search"
|
|
18
|
+
size="mini"
|
|
19
|
+
style="width: 50%"
|
|
20
|
+
clearable
|
|
21
|
+
@clear="cleanSearch"
|
|
22
|
+
/>
|
|
23
|
+
<el-button
|
|
24
|
+
size="mini"
|
|
25
|
+
@click="searchInfo"
|
|
26
|
+
>搜索</el-button>
|
|
27
|
+
</div>
|
|
28
|
+
<el-empty
|
|
29
|
+
v-if="!iconList || iconList.length === 0"
|
|
30
|
+
description="暂无数据!"
|
|
31
|
+
style="height: 270px;width: 100%"
|
|
32
|
+
/>
|
|
33
|
+
<div
|
|
34
|
+
v-for="item in iconList"
|
|
35
|
+
:key="item.unicode_decimal"
|
|
36
|
+
class="icon-item"
|
|
37
|
+
@click="selectIcon(item)"
|
|
38
|
+
>
|
|
39
|
+
<el-tooltip
|
|
40
|
+
placement="top"
|
|
41
|
+
>
|
|
42
|
+
<div slot="content">
|
|
43
|
+
<span>图标名称: {{ item.name }}</span>
|
|
44
|
+
<br>
|
|
45
|
+
<br>
|
|
46
|
+
<span>class: {{ item.font_class }}</span>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="icon-box">
|
|
49
|
+
|
|
50
|
+
<svg-icon
|
|
51
|
+
:icon-class="item.font_class"
|
|
52
|
+
/>
|
|
53
|
+
<span :title="item.name">{{ item.name }}</span>
|
|
54
|
+
</div>
|
|
55
|
+
</el-tooltip>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="paging">
|
|
58
|
+
<span>第 {{ pagination + 1 }} 页</span>
|
|
59
|
+
<el-pagination
|
|
60
|
+
small
|
|
61
|
+
background
|
|
62
|
+
layout="total, prev, next"
|
|
63
|
+
:total="total"
|
|
64
|
+
@current-change="handleCurrentChange"
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<el-button
|
|
68
|
+
type="info"
|
|
69
|
+
size="mini"
|
|
70
|
+
@click="visible = false"
|
|
71
|
+
>取消</el-button>
|
|
72
|
+
<el-button
|
|
73
|
+
class="button"
|
|
74
|
+
size="mini"
|
|
75
|
+
@click="select"
|
|
76
|
+
>确定</el-button>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<el-button
|
|
80
|
+
slot="reference"
|
|
81
|
+
class="button"
|
|
82
|
+
:size="bottomSize"
|
|
83
|
+
@click="visible = !visible; selectIconClass = null"
|
|
84
|
+
>{{ hint }}</el-button>
|
|
85
|
+
</el-popover>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script>
|
|
90
|
+
import axios from 'axios'
|
|
91
|
+
export default {
|
|
92
|
+
name: 'TfIconPicker',
|
|
93
|
+
props: {
|
|
94
|
+
width: {
|
|
95
|
+
default: 400,
|
|
96
|
+
type: Number
|
|
97
|
+
},
|
|
98
|
+
placement: {
|
|
99
|
+
default: 'bottom',
|
|
100
|
+
type: String
|
|
101
|
+
},
|
|
102
|
+
bottomSize: {
|
|
103
|
+
default: 'small',
|
|
104
|
+
type: String
|
|
105
|
+
},
|
|
106
|
+
hint: {
|
|
107
|
+
default: '选择图标',
|
|
108
|
+
type: String
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
data () {
|
|
112
|
+
return {
|
|
113
|
+
glyphsList: null,
|
|
114
|
+
allIconList: null,
|
|
115
|
+
pagination: 0,
|
|
116
|
+
iconList: null,
|
|
117
|
+
total: 0,
|
|
118
|
+
selectIconClass: null,
|
|
119
|
+
visible: false,
|
|
120
|
+
search: null
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
watch: {
|
|
124
|
+
pagination: {
|
|
125
|
+
handler: function (newValue) {
|
|
126
|
+
if (!this.glyphsList) return
|
|
127
|
+
this.iconList = this.allIconList.slice(newValue * 20, (newValue + 1) * 20)
|
|
128
|
+
},
|
|
129
|
+
immediate: true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
created () {
|
|
133
|
+
axios.get('/icon-list.json').then((res) => {
|
|
134
|
+
if (res.status === 200) {
|
|
135
|
+
const { glyphs: glyphsList } = res.data
|
|
136
|
+
this.glyphsList = glyphsList.sort((a, b) => a.font_class - b.font_class)
|
|
137
|
+
this.allIconList = JSON.parse(JSON.stringify(this.glyphsList))
|
|
138
|
+
this.total = this.allIconList?.length
|
|
139
|
+
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20)
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
},
|
|
143
|
+
methods: {
|
|
144
|
+
handleCurrentChange (val) {
|
|
145
|
+
if (val - 1 > this.total / 20) return
|
|
146
|
+
this.pagination = val - 1
|
|
147
|
+
},
|
|
148
|
+
selectIcon (params) {
|
|
149
|
+
this.selectIconClass = params
|
|
150
|
+
},
|
|
151
|
+
searchInfo () {
|
|
152
|
+
this.pagination = 0
|
|
153
|
+
const glyphs = JSON.parse(JSON.stringify(this.glyphsList))
|
|
154
|
+
const iconArr = []
|
|
155
|
+
glyphs.forEach(item => {
|
|
156
|
+
const str = `${item.font_class}+${item.name}`.toLowerCase()
|
|
157
|
+
if (str.indexOf(this.search.toLowerCase()) !== -1) {
|
|
158
|
+
iconArr.push(item)
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
this.allIconList = iconArr
|
|
162
|
+
this.total = this.allIconList.length
|
|
163
|
+
if (iconArr.length > 20) {
|
|
164
|
+
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20).sort((a, b) => a.font_class - b.font_class)
|
|
165
|
+
} else {
|
|
166
|
+
this.iconList = iconArr.sort((a, b) => a.font_class - b.font_class)
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
cleanSearch () {
|
|
170
|
+
this.pagination = 0
|
|
171
|
+
this.allIconList = JSON.parse(JSON.stringify(this.glyphsList))
|
|
172
|
+
this.total = this.allIconList?.length
|
|
173
|
+
this.iconList = this.allIconList.slice(this.pagination * 20, (this.pagination + 1) * 20)
|
|
174
|
+
},
|
|
175
|
+
select () {
|
|
176
|
+
if (this.selectIconClass) {
|
|
177
|
+
this.$emit('selectIcon', JSON.parse(JSON.stringify(this.selectIconClass)))
|
|
178
|
+
} else {
|
|
179
|
+
this.$message.error('未选择图标')
|
|
180
|
+
}
|
|
181
|
+
this.selectIconClass = null
|
|
182
|
+
this.visible = false
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<style lang="less" scoped>
|
|
189
|
+
.content-view {
|
|
190
|
+
min-height: 300px;
|
|
191
|
+
display: flex;
|
|
192
|
+
justify-content: left;
|
|
193
|
+
align-items: center;
|
|
194
|
+
flex-wrap: wrap;
|
|
195
|
+
align-content: flex-start;
|
|
196
|
+
.search-box {
|
|
197
|
+
width: 100%;
|
|
198
|
+
display: flex;
|
|
199
|
+
justify-content: left;
|
|
200
|
+
align-items: center;
|
|
201
|
+
gap: 0 10px;
|
|
202
|
+
color: red;
|
|
203
|
+
.svg-icon {
|
|
204
|
+
height: 20px;
|
|
205
|
+
width: 20px;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
.icon-item {
|
|
209
|
+
width: 20%;
|
|
210
|
+
height: 60px;
|
|
211
|
+
display: flex;
|
|
212
|
+
margin-top: 10px;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
.icon-box {
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
padding: 5px 0;
|
|
218
|
+
border-radius: 2px;
|
|
219
|
+
border: 1px solid #eeeeee;
|
|
220
|
+
display: inherit;
|
|
221
|
+
flex-direction: column;
|
|
222
|
+
justify-content: space-between;
|
|
223
|
+
align-items: center;
|
|
224
|
+
width: 60px;
|
|
225
|
+
height: 100%;
|
|
226
|
+
color: #666666;
|
|
227
|
+
&:hover {
|
|
228
|
+
color: #2a90e9;
|
|
229
|
+
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
230
|
+
}
|
|
231
|
+
.svg-icon {
|
|
232
|
+
height: 25px;
|
|
233
|
+
width: 25px;
|
|
234
|
+
}
|
|
235
|
+
span {
|
|
236
|
+
line-height: 1;
|
|
237
|
+
box-sizing: border-box;
|
|
238
|
+
padding: 0 2px;
|
|
239
|
+
text-align: center;
|
|
240
|
+
width: 60px;
|
|
241
|
+
display: inline-block;
|
|
242
|
+
white-space: nowrap;
|
|
243
|
+
overflow: hidden;
|
|
244
|
+
text-overflow: ellipsis;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
font-size: 12px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
.paging {
|
|
251
|
+
display: flex;
|
|
252
|
+
justify-content: right;
|
|
253
|
+
align-items: center;
|
|
254
|
+
margin-top: 10px;
|
|
255
|
+
height: 20px;
|
|
256
|
+
width: 100%;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
.button {
|
|
260
|
+
opacity: 1;
|
|
261
|
+
background: #0c4c8e;
|
|
262
|
+
border-radius: 2px;
|
|
263
|
+
font-weight: 700;
|
|
264
|
+
color: #FFFFFF;
|
|
265
|
+
}
|
|
266
|
+
</style>
|