web-component-gallery 1.3.12 → 2.0.2

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.
Files changed (218) hide show
  1. package/dist/923.umd.js +1 -0
  2. package/dist/index.umd.js +1 -12252
  3. package/dist/js.umd.js +1 -0
  4. package/dist/style.css +17 -0
  5. package/dist/style.umd.js +1 -0
  6. package/{method → extensions}/AMap.js +1 -5
  7. package/{plugins/method → extensions}/Dialog.js +2 -2
  8. package/{lib/lazy_use.js → extensions/index.js} +16 -2
  9. package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
  10. package/lib/amap-comp/index.js +18 -0
  11. package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
  12. package/lib/amap-comp/style/index.js +1 -0
  13. package/lib/amap-comp/style/index.less +1 -0
  14. package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
  15. package/lib/amap-draw/style/index.js +1 -0
  16. package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
  17. package/lib/browse/index.jsx +0 -2
  18. package/lib/browse/style/index.js +1 -0
  19. package/lib/button/Button.js +1 -3
  20. package/lib/button/style/index.js +1 -0
  21. package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
  22. package/lib/date-time/style/index.js +1 -0
  23. package/lib/date-time/style/index.less +7 -0
  24. package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
  25. package/lib/descriptions-list/style/index.js +1 -0
  26. package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
  27. package/lib/directory/index.js +8 -0
  28. package/lib/directory/style/index.js +1 -0
  29. package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
  30. package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
  31. package/lib/form-comp/ARadio.vue +70 -0
  32. package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
  33. package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
  34. package/lib/form-comp/ATagsInput.vue +88 -0
  35. package/lib/form-comp/ATimePicker.vue +127 -0
  36. package/lib/{form/components → form-comp}/AUpload.vue +2 -17
  37. package/lib/form-comp/index.js +37 -0
  38. package/lib/form-comp/style/ACascaderMultiple.less +117 -0
  39. package/lib/form-comp/style/ARadio.less +0 -0
  40. package/lib/form-comp/style/ARangePicker.less +11 -0
  41. package/lib/form-comp/style/ASelectCustom.less +4 -0
  42. package/lib/form-comp/style/ATagsInput.less +24 -0
  43. package/lib/form-comp/style/ATimePicker.less +8 -0
  44. package/lib/form-comp/style/AUpload.less +15 -0
  45. package/lib/form-comp/style/index.js +1 -0
  46. package/lib/form-comp/style/index.less +7 -0
  47. package/lib/index.js +60 -45
  48. package/lib/modal/index.jsx +4 -6
  49. package/lib/modal/style/index.js +1 -0
  50. package/lib/modal/{index.less → style/index.less} +6 -7
  51. package/{plugins/lib/form → lib/model}/Model.js +1 -3
  52. package/lib/model/index.js +7 -0
  53. package/lib/model/style/index.js +1 -0
  54. package/lib/{form/style/Model.less → model/style/index.less} +10 -10
  55. package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
  56. package/lib/{form → model}/utils/resetFields.js +1 -1
  57. package/lib/no-data/directive.js +65 -0
  58. package/lib/no-data/index.js +21 -0
  59. package/lib/no-data/index.vue +35 -0
  60. package/lib/no-data/style/index.js +1 -0
  61. package/lib/no-data/style/index.less +15 -0
  62. package/lib/search/index.js +7 -0
  63. package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
  64. package/lib/search/style/index.js +1 -0
  65. package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
  66. package/lib/style/mixins.less +1 -1
  67. package/lib/{svgIcon → svg-icon}/index.vue +1 -17
  68. package/lib/svg-icon/style/index.js +1 -0
  69. package/lib/svg-icon/style/index.less +15 -0
  70. package/lib/table/index.vue +4 -8
  71. package/lib/table/style/index.js +1 -0
  72. package/lib/table/style/index.less +12 -13
  73. package/lib/tree/index.js +2 -11
  74. package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
  75. package/lib/tree/style/index.js +1 -0
  76. package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
  77. package/lib/weather/index.vue +1 -9
  78. package/lib/weather/style/index.js +1 -0
  79. package/lib/weather/style/index.less +7 -0
  80. package/package.json +16 -34
  81. package/utils/Axios.js +91 -82
  82. package/utils/Postcss.js +12 -8
  83. package/README.md +0 -24
  84. package/dist/amap.umd.js +0 -12252
  85. package/dist/avatar.umd.js +0 -5337
  86. package/dist/button.umd.js +0 -5845
  87. package/dist/dateTime.umd.js +0 -1287
  88. package/dist/form.umd.js +0 -9981
  89. package/dist/multiTab.umd.js +0 -5556
  90. package/dist/svgIcon.umd.js +0 -1167
  91. package/dist/table.umd.js +0 -6306
  92. package/dist/tree.umd.js +0 -5393
  93. package/dist/weather.umd.js +0 -1167
  94. package/lib/amap/components/AmapSearch/index.less +0 -16
  95. package/lib/amap/index.js +0 -13
  96. package/lib/avatar/index.js +0 -7
  97. package/lib/avatar/index.vue +0 -47
  98. package/lib/basic/404.vue +0 -24
  99. package/lib/dateTime/index.vue +0 -43
  100. package/lib/form/Model.js +0 -153
  101. package/lib/form/Search.vue +0 -159
  102. package/lib/form/components/ACascaderMultiple.vue +0 -766
  103. package/lib/form/components/ARadio.vue +0 -74
  104. package/lib/form/components/ATagsInput.vue +0 -93
  105. package/lib/form/components/ATimePicker.vue +0 -73
  106. package/lib/form/index.js +0 -55
  107. package/lib/form/style/Search.less +0 -34
  108. package/lib/form/utils/render.js +0 -85
  109. package/lib/iframe/events.js +0 -2
  110. package/lib/iframe/index.jsx +0 -234
  111. package/lib/iframe/index.less +0 -19
  112. package/lib/multiTab/APIEnums.js +0 -17
  113. package/lib/multiTab/MultiTab.jsx +0 -237
  114. package/lib/multiTab/RouteAPI.js +0 -71
  115. package/lib/multiTab/RouteContent.jsx +0 -90
  116. package/lib/multiTab/RouteKeepAlive.js +0 -183
  117. package/lib/multiTab/events.js +0 -2
  118. package/lib/multiTab/index.js +0 -15
  119. package/lib/multiTab/index.less +0 -73
  120. package/lib/style/index.less +0 -2
  121. package/lib/tree/Directory.js +0 -428
  122. package/lib/tree/Tree.vue +0 -181
  123. package/lib/tree/style/Tree.less +0 -52
  124. package/method/Dialog.js +0 -134
  125. package/method/index.js +0 -12
  126. package/plugins/lib/amap/AmapDraw.jsx +0 -349
  127. package/plugins/lib/amap/AmapDraw.less +0 -45
  128. package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
  129. package/plugins/lib/amap/index.js +0 -13
  130. package/plugins/lib/avatar/index.js +0 -7
  131. package/plugins/lib/avatar/index.vue +0 -47
  132. package/plugins/lib/basic/404.vue +0 -24
  133. package/plugins/lib/browse/index.jsx +0 -76
  134. package/plugins/lib/browse/index.less +0 -4
  135. package/plugins/lib/button/Button.js +0 -89
  136. package/plugins/lib/button/index.js +0 -7
  137. package/plugins/lib/dateTime/index.js +0 -7
  138. package/plugins/lib/descriptions/index.jsx +0 -108
  139. package/plugins/lib/descriptions/index.less +0 -15
  140. package/plugins/lib/form/components/ARadio.vue +0 -74
  141. package/plugins/lib/form/components/ARangePicker.vue +0 -129
  142. package/plugins/lib/form/components/ASelectCustom.vue +0 -226
  143. package/plugins/lib/form/components/ATagsInput.vue +0 -93
  144. package/plugins/lib/form/components/ATimePicker.vue +0 -73
  145. package/plugins/lib/form/components/AUpload.vue +0 -183
  146. package/plugins/lib/form/components/RenderComp.vue +0 -69
  147. package/plugins/lib/form/index.js +0 -55
  148. package/plugins/lib/form/style/Model.less +0 -53
  149. package/plugins/lib/form/utils/resetFields.js +0 -16
  150. package/plugins/lib/iframe/events.js +0 -2
  151. package/plugins/lib/iframe/index.jsx +0 -234
  152. package/plugins/lib/iframe/index.less +0 -19
  153. package/plugins/lib/index.js +0 -72
  154. package/plugins/lib/lazy_use.js +0 -40
  155. package/plugins/lib/modal/index.jsx +0 -53
  156. package/plugins/lib/modal/index.less +0 -50
  157. package/plugins/lib/multiTab/APIEnums.js +0 -17
  158. package/plugins/lib/multiTab/MultiTab.jsx +0 -237
  159. package/plugins/lib/multiTab/RouteAPI.js +0 -71
  160. package/plugins/lib/multiTab/RouteContent.jsx +0 -90
  161. package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
  162. package/plugins/lib/multiTab/events.js +0 -2
  163. package/plugins/lib/multiTab/index.js +0 -15
  164. package/plugins/lib/multiTab/index.less +0 -73
  165. package/plugins/lib/style/index.less +0 -2
  166. package/plugins/lib/style/mixins.less +0 -79
  167. package/plugins/lib/svgIcon/index.js +0 -7
  168. package/plugins/lib/svgIcon/index.vue +0 -77
  169. package/plugins/lib/table/index.js +0 -7
  170. package/plugins/lib/table/index.vue +0 -217
  171. package/plugins/lib/table/style/index.less +0 -50
  172. package/plugins/lib/tree/index.js +0 -17
  173. package/plugins/lib/tree/style/Directory.less +0 -119
  174. package/plugins/lib/weather/index.js +0 -7
  175. package/plugins/lib/weather/index.vue +0 -58
  176. package/plugins/method/AMap.js +0 -368
  177. package/plugins/method/PageLoading.jsx +0 -106
  178. package/plugins/method/Theme.js +0 -88
  179. package/plugins/method/index.js +0 -12
  180. package/plugins/store/auth.js +0 -31
  181. package/plugins/store/cache.js +0 -56
  182. package/plugins/store/chat.js +0 -74
  183. package/plugins/store/project.js +0 -46
  184. package/plugins/utils/Axios.js +0 -105
  185. package/plugins/utils/Base64.js +0 -314
  186. package/plugins/utils/Filter.js +0 -249
  187. package/plugins/utils/PostMessage.js +0 -16
  188. package/plugins/utils/Postcss.js +0 -9
  189. package/plugins/utils/Rem.js +0 -24
  190. package/plugins/utils/Request.js +0 -38
  191. package/plugins/utils/Storage.js +0 -73
  192. package/plugins/utils/Tree.js +0 -169
  193. package/plugins/utils/Utils.js +0 -51
  194. package/plugins/utils/Validate.js +0 -33
  195. package/plugins/utils/Websocket.js +0 -186
  196. package/utils/PostMessage.js +0 -16
  197. package/utils/Request.js +0 -38
  198. /package/{method → extensions}/PageLoading.jsx +0 -0
  199. /package/{method → extensions}/Theme.js +0 -0
  200. /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
  201. /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
  202. /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
  203. /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
  204. /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
  205. /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
  206. /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
  207. /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
  208. /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
  209. /package/{plugins/font → font}/PingFang SC.ttf +0 -0
  210. /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
  211. /package/{plugins/font → font}/font.css +0 -0
  212. /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
  213. /package/lib/browse/{index.less → style/index.less} +0 -0
  214. /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
  215. /package/lib/{dateTime → date-time}/index.js +0 -0
  216. /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
  217. /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
  218. /package/lib/{svgIcon → svg-icon}/index.js +0 -0
@@ -1,226 +0,0 @@
1
- <template>
2
- <div
3
- @mousedown="
4
- e => {
5
- e.preventDefault()
6
- !attrs.disabled && (selectOpen = true)
7
- }
8
- "
9
- ref="main"
10
- class="ASelectCustom"
11
- >
12
- <Select
13
- class="t_select"
14
- v-model="childSelectedValue"
15
- :style="{ width: width || '100%' }"
16
- :placeholder="placeholder"
17
- :open="selectOpen"
18
- :filterOption="filterOption"
19
- @select="handleSelect"
20
- v-bind="attrs"
21
- v-on="$listeners"
22
- :mode="mode"
23
- >
24
- <template v-for="(index, name) in $slots" v-slot:[name]>
25
- <slot :name="name" />
26
- </template>
27
- <template v-for="(index, name) in $scopedSlots" v-slot:[name]="data">
28
- <slot :name="name" v-bind="data"></slot>
29
- </template>
30
- <div slot="dropdownRender" slot-scope="menu">
31
- <Checkbox v-if="mode && !isShowPagination" :checked="selectChecked" @change="selectAll">
32
- 全选
33
- </Checkbox>
34
- <v-nodes :vnodes="menu" />
35
- <div class="t_select__pagination" v-if="isShowPagination">
36
- <Pagination
37
- :page-size.sync="paginationOption.pageSize"
38
- v-model="paginationOption.current"
39
- :total="paginationOption.total"
40
- @change="currentChange"
41
- v-bind="{
42
- size: 'small',
43
- 'hide-on-single-page': true,
44
- showQuickJumper: true,
45
- ...$attrs,
46
- ...paginationOption.bind
47
- }"
48
- v-on="$listeners"
49
- />
50
- </div>
51
- </div>
52
- <SelectOption v-for="(item, index) in options" :key="index" :value="item[valueKey]">
53
- {{ customLabel ? customLabelHandler(item) : item[labelKey] }}
54
- </SelectOption>
55
- </Select>
56
- </div>
57
- </template>
58
- <script>
59
- import { Select, Checkbox, Pagination } from 'ant-design-vue'
60
-
61
- export default {
62
- name: 'TAntdSelect',
63
- components: {
64
- VNodes: {
65
- functional: true,
66
- render: (h, ctx) => ctx.props.vnodes
67
- },
68
- Select,
69
- SelectOption: Select.Option,
70
- Checkbox,
71
- Pagination
72
- },
73
- props: {
74
- value: {
75
- type: [String, Number, Array, Boolean, Object],
76
- default: undefined
77
- },
78
- // 多选 'multiple'
79
- mode: {
80
- type: String
81
- },
82
- // 是否支持输入
83
- isInput: {
84
- type: Boolean,
85
- default: false
86
- },
87
- placeholder: {
88
- type: String,
89
- default: '请选择'
90
- },
91
- // 选择框宽度
92
- width: {
93
- type: String
94
- },
95
- // 是否自定义设置下拉label
96
- customLabel: {
97
- type: String
98
- },
99
- // 传入的option数组中,要作为最终选择项的键值key
100
- valueKey: {
101
- type: String,
102
- default: 'value'
103
- },
104
- // 传入的option数组中,要作为显示项的键值名称
105
- labelKey: {
106
- type: String,
107
- default: 'label'
108
- },
109
- // 下拉框组件数据源
110
- options: {
111
- type: Array
112
- },
113
- // 是否显示分页
114
- isShowPagination: {
115
- type: Boolean,
116
- default: false
117
- },
118
- // 分页配置项
119
- paginationOption: {
120
- type: Object,
121
- default: () => {
122
- return {
123
- pageSize: 6, // 每页显示条数
124
- current: 1, // 当前页
125
- total: 0 // 总条数
126
- }
127
- }
128
- }
129
- },
130
- data() {
131
- return {
132
- selectOpen: false
133
- }
134
- },
135
- computed: {
136
- childSelectedValue: {
137
- get() {
138
- return this.value
139
- },
140
- set(val) {
141
- this.$emit('input', val)
142
- }
143
- },
144
- attrs() {
145
- return {
146
- allowClear: true,
147
- showSearch: true,
148
- ...this.$attrs
149
- }
150
- },
151
- selectChecked: {
152
- get() {
153
- return this.childSelectedValue?.length === this.options?.length
154
- },
155
- set(val) {
156
- this.$emit('input', val)
157
- }
158
- }
159
- },
160
- mounted() {
161
- document.addEventListener('click', this.bodyCloseMenus)
162
- },
163
- beforeDestroy() {
164
- document.removeEventListener('click', this.bodyCloseMenus)
165
- },
166
- methods: {
167
- filterOption(input, option) {
168
- this.isInput && (this.childSelectedValue = input)
169
- return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
170
- },
171
- // 点击空白区域
172
- bodyCloseMenus(e) {
173
- if (this.$refs.main && !this.$refs.main.contains(e.target)) {
174
- if (this.selectOpen == true) {
175
- this.selectOpen = false
176
- }
177
- }
178
- },
179
- // 点击全选
180
- selectAll(val) {
181
- const options = JSON.parse(JSON.stringify(this.options))
182
- if (val.target.checked) {
183
- const childSelectedValue = options?.map(item => {
184
- return item[this.valueKey]
185
- })
186
- setTimeout(() => {
187
- this.$emit('input', childSelectedValue)
188
- }, 0)
189
- } else {
190
- this.$emit('input', null)
191
- }
192
- this.selectOpen = false
193
- },
194
- handleSelect(value, option) {
195
- if (value) {
196
- this.selectOpen = false
197
- }
198
- const options = this.options.find(e => e[this.valueKey] == value)
199
- options[this.valueKey] && this.$emit('select', value, options)
200
- },
201
- // 切换分页
202
- currentChange(val) {
203
- // console.log('切换分页', val)
204
- if (!this.mode) {
205
- this.childSelectedValue = null
206
- }
207
- setTimeout(() => {
208
- this.selectOpen = true
209
- }, 0)
210
- this.$emit('current-change', val)
211
- },
212
- // 自定义label显示
213
- customLabelHandler(item) {
214
- // eslint-disable-next-line no-eval
215
- return eval(this.customLabel)
216
- }
217
- }
218
- }
219
- </script>
220
- <style lang="less" scoped>
221
- // 添加flex属性解决css中div莫名高度
222
- .ASelectCustom {
223
- width: 100%;
224
- // display: flex;
225
- }
226
- </style>
@@ -1,93 +0,0 @@
1
- <template>
2
- <div class="ant-input TAntdTags" v-on="$listeners">
3
- <Tooltip
4
- :key="i"
5
- :title="child[labelKey]"
6
- v-for="(child, i) in selectChecked"
7
- >
8
- <Tag
9
- closable
10
- @close="() => tagsClose(child[valueKey])"
11
- >
12
- <span>{{ child[labelKey] }}</span>
13
- </Tag>
14
- </Tooltip>
15
- <span v-if="!selectChecked.length">请点击进行选择</span>
16
- </div>
17
- </template>
18
-
19
- <script>
20
-
21
- import { Tag, Tooltip } from 'ant-design-vue'
22
-
23
- export default {
24
- name: 'TAntdTags',
25
- components: { Tag, Tooltip },
26
- model: {
27
- prop: 'value',
28
- event: 'update:tagsInput'
29
- },
30
- data() {
31
- return {}
32
- },
33
- computed: {
34
- selectChecked: {
35
- get() {
36
- return this.value
37
- },
38
- set(val) {
39
- this.$emit('update:tagsInput', val)
40
- }
41
- }
42
- },
43
-
44
- props: {
45
- value: {
46
- type: Array,
47
- default: () => {
48
- return []
49
- }
50
- },
51
- /* 传入的option数组中,要作为最终选择项的键值key */
52
- valueKey: {
53
- type: String,
54
- default: 'value'
55
- },
56
- /* 传入的option数组中,要作为显示项的键值名称 */
57
- labelKey: {
58
- type: String,
59
- default: 'label'
60
- }
61
- },
62
-
63
- methods: {
64
- tagsClose(checked) {
65
- const selectChecked =
66
- this.selectChecked.filter(node => node[this.valueKey] !== checked)
67
- this.$emit('update:tagsInput', selectChecked)
68
- }
69
- }
70
- }
71
- </script>
72
-
73
- <style lang="less" scoped>
74
- @import url('../../style/mixins.less');
75
- .TAntdTags {
76
- width: 100%;
77
- height: auto;
78
- cursor: pointer;
79
-
80
- :deep(.ant-tag) {
81
- cursor: pointer;
82
- display: inline-flex;
83
- align-items: center;
84
-
85
- span {
86
- display: inline-block;
87
- max-width: 100px;
88
- overflow-x: hidden;
89
- .ellipsis();
90
- }
91
- }
92
- }
93
- </style>
@@ -1,73 +0,0 @@
1
- <template>
2
- <div class="ATimePicker">
3
- <TimePicker
4
- :format="format"
5
- v-model="time[0]"
6
- placeholder="开始时间"
7
- :valueFormat="valueFormat"
8
- @change="e => time.splice(0, 1, e)"
9
- />
10
- <span>~</span>
11
- <TimePicker :format="format" v-model="time[1]" placeholder="结束时间" :valueFormat="valueFormat" />
12
- </div>
13
- </template>
14
-
15
- <script>
16
-
17
- import { TimePicker } from 'ant-design-vue'
18
-
19
- export default {
20
- components: {
21
- TimePicker
22
- },
23
- model: {
24
- prop: 'value',
25
- event: 'update:timePicker'
26
- },
27
- props: {
28
- value: {
29
- type: Array,
30
- default: () => {
31
- return []
32
- }
33
- },
34
- format: {
35
- type: String,
36
- default: 'HH:mm:ss'
37
- },
38
- valueFormat: {
39
- type: String,
40
- default: 'HH:mm:ss'
41
- }
42
- },
43
- watch: {
44
- value(e, o) {
45
- if (e.toString() == o.toString()) return
46
- this.time = e
47
- },
48
- 'time.length': {
49
- handler(e) {
50
- this.$emit('update:timePicker', e == 2 ? this.time : [])
51
- },
52
- deep: true
53
- }
54
- },
55
- data() {
56
- return {
57
- time: []
58
- }
59
- },
60
- created() {},
61
- methods: {}
62
- }
63
- </script>
64
- <style lang="less" scoped>
65
- @import "~ant-design-vue/es/style/themes/default";
66
- .ATimePicker {
67
- width: 100%;
68
- display: flex;
69
- align-items: center;
70
- &>span { margin: 0 @padding-xs; }
71
- :deep(.ant-time-picker) { flex: 1; }
72
- }
73
- </style>
@@ -1,183 +0,0 @@
1
- <template>
2
- <div class="TAntdUpload">
3
- <Upload
4
- name="file"
5
- :file-list="fileList"
6
- :accept="fileAccept"
7
- v-bind="uploadAttrs"
8
- @change="handleFileChange"
9
- @preview="handleFilePreview"
10
- @reject="$message.error(`上传文件类型只能为${fileAccept}`)"
11
- >
12
- <Button
13
- type="primary"
14
- v-if="uploadAttrs.listType === 'text'"
15
- >
16
- <Icon type="upload" />上传
17
- </Button>
18
- <template v-else>
19
- <Icon v-if="!fileList || fileList.length < uploadLen"
20
- type="plus"
21
- style="fontsize: 36px"
22
- />
23
- </template>
24
- </Upload>
25
-
26
- <span class="tips" v-if="tips">{{ tips }}</span>
27
- </div>
28
- </template>
29
-
30
- <script>
31
-
32
- import { Icon, Button, Upload } from 'ant-design-vue'
33
-
34
- export default {
35
- model: {
36
- prop: 'value',
37
- event: 'handleFileUpload'
38
- },
39
- components: { Icon, Button, Upload },
40
- props: {
41
- value: {
42
- type: [String, Array],
43
- default: () => []
44
- },
45
- /* 提示文字 */
46
- tips: String,
47
- /* 上传文件数量限制 */
48
- uploadLen: {
49
- type: Number,
50
- default: 1
51
- },
52
- /* 上传接口 */
53
- fileUploadUrl: String,
54
- /* 显示需要pin的接口前缀 */
55
- filePrefixUrl: String,
56
- /* 上传文件格式限制 */
57
- fileAccept: String,
58
- /* 上传文件携带Headers信息 */
59
- fileHeaders: Object,
60
- /* 删除文件函数回调 */
61
- fileRemoveHandle: Function
62
- },
63
- data() {
64
- return {
65
- fileList: [],
66
- modalValue: []
67
- }
68
- },
69
- watch: {
70
- value() {
71
- this.setResetFile()
72
- }
73
- },
74
- computed: {
75
- uploadAttrs() {
76
- return {
77
- listType: 'picture-card',
78
- prefix: this.filePrefixUrl ?? this.$https.FILEURL,
79
- action: this.fileUploadUrl ?? this.$https.UPLOADURL,
80
- headers: this.fileHeaders ?? this.$store.getters.fileHeaders,
81
- ...this.$attrs
82
- }
83
- }
84
- },
85
- mounted() {
86
- this.setResetFile()
87
- },
88
- methods: {
89
- setResetFile() {
90
- let arrayObject
91
- try {
92
- arrayObject = JSON.parse(this.value)
93
- } catch (e) {
94
- arrayObject = [].concat(this.value)
95
- }
96
- this.modalValue = arrayObject ?? []
97
- this.fileList = this.modalValue.map(file => ({
98
- ...file,
99
- url: `${this.uploadAttrs.prefix}${file.url}`,
100
- type: file.contentType,
101
- status: 'done'
102
- }))
103
- },
104
-
105
- handleFilePreview({ uid, contentType, url }) {
106
-
107
- let suffix = url.substr( url.lastIndexOf('.') + 1 )
108
- const pictureSuffix = ['JPEG', 'JPG', 'GIF', 'PNG', 'TIFF', 'WEBP', 'BMP']
109
-
110
- if (contentType.includes('image') || pictureSuffix.includes(suffix.toUpperCase())) {
111
- this.$viewerApi({
112
- options: {
113
- url: 'url',
114
- toolbar: true,
115
- initialViewIndex: this.fileList.findIndex(file => file.url == url)
116
- },
117
- images: this.fileList
118
- })
119
- return
120
- }
121
-
122
- this.$dialog(
123
- 'Brower',
124
- { data: url },
125
- {
126
- title: '预览文件',
127
- width: 1104,
128
- height: 848,
129
- centered: true,
130
- maskClosable: false,
131
- footer: false,
132
- bodyStyle: {
133
- height: 'calc( 100% - 54px )'
134
- }
135
- }
136
- )
137
- },
138
-
139
- handleFileChange({ file, fileList }) {
140
-
141
- file.status == 'uploading' && (this.fileList = fileList)
142
-
143
- switch (file.status) {
144
- case 'removed':
145
- const params = { id: file.uid }
146
- const requestHandle =
147
- this.fileRemoveHandle ?
148
- this.fileRemoveHandle(params) :
149
- this.$store.dispatch('fileRemoveHandle', params)
150
- requestHandle.then( Response => {
151
- const i = this.modalValue.findIndex(e => e.uid == file.uid)
152
- this.modalValue.splice(i, 1)
153
- this.$emit('handleFileUpload', JSON.stringify(this.modalValue))
154
- } )
155
- break
156
- case 'done':
157
- const { data } = file.response
158
- const uploadFileObj = { ...data, uid: data.id }
159
- delete uploadFileObj.id
160
- this.modalValue.push(uploadFileObj)
161
- this.$emit('handleFileUpload', JSON.stringify(this.modalValue))
162
- break
163
- }
164
- }
165
- }
166
- }
167
- </script>
168
- <style lang="less" scoped>
169
- .TAntdUpload {
170
- .tips {
171
- width: 100%;
172
- display: flex;
173
- justify-content: flex-end;
174
- }
175
-
176
- :deep(.ant-upload) {
177
- background: transparent;
178
- }
179
- :deep(.ant-upload-picture-card-wrapper) {
180
- display: flex;
181
- }
182
- }
183
- </style>
@@ -1,69 +0,0 @@
1
- <template>
2
- <component
3
- :is="component"
4
- v-bind="$attrs"
5
- v-on="$listeners"
6
- v-model="nodeValue"
7
- :placeholder='getPlaceholder()'
8
- :getPopupContainer="
9
- triggerNode => {
10
- return triggerNode.parentNode || document.body
11
- }
12
- "
13
- />
14
- </template>
15
- <script>
16
- import { Input,InputNumber,Checkbox,DatePicker,Cascader,TreeSelect,Switch } from 'ant-design-vue'
17
-
18
- export default {
19
- name: 'RenderComp',
20
- model: {
21
- prop: "value",
22
- event: "update:renderComp"
23
- },
24
- components: {
25
- Input,
26
- Textarea: Input.TextArea,
27
- InputNumber,
28
- Checkbox,
29
- CheckboxGroup: Checkbox.Group,
30
- DatePicker,
31
- Cascader,
32
- TreeSelect,
33
- ASwitch: Switch,
34
- ARadio: () => import('./ARadio.vue'),
35
- AUpload: () => import( './AUpload.vue' ),
36
- ATagsInput: () => import('./ATagsInput.vue'),
37
- ASelectCustom: () => import('./ASelectCustom.vue'),
38
- ACascaderMultiple: () => import('./ACascaderMultiple.vue'),
39
- ATimePicker: () => import('./ATimePicker.vue'),
40
- ARangePicker: () => import('./ARangePicker.vue')
41
- },
42
- props: {
43
- value: [String, Number, Boolean, Object, Array, Symbol],
44
- component: {
45
- type: String,
46
- default: 'Input'
47
- }
48
- },
49
- computed: {
50
- nodeValue: {
51
- get () {
52
- return this.value
53
- },
54
- set ( value ) {
55
- this.$emit('update:renderComp', value)
56
- }
57
- }
58
- },
59
- mounted() {
60
- },
61
- methods: {
62
- getPlaceholder() {
63
- const RegExp = this.component.toLowerCase()
64
- if( /range/.test( RegExp ) ) return [ '开始时间', '结束时间' ]
65
- return this.$attrs.placeholder || /(select|picker|radio|upload)/.test( RegExp ) ? "请选择" : "请输入"
66
- }
67
- }
68
- }
69
- </script>
@@ -1,55 +0,0 @@
1
- /* Model新增修改表单 */
2
- import Model from './Model.js'
3
- /* Search搜索表单 */
4
- import Search from './Search.vue'
5
-
6
- Model.install = function (Vue) {
7
- Vue.component(Model.name, Model)
8
- }
9
-
10
- Search.install = function (Vue) {
11
- Vue.component(Search.name, Search)
12
- }
13
-
14
- export {
15
- Model,
16
- Search,
17
- }
18
-
19
- /* 下拉多选框(可支持树结构 */
20
- import ACascaderMultiple from './components/ACascaderMultiple.vue'
21
- /* 下拉单选及分页框 */
22
- import ASelectCustom from './components/ASelectCustom.vue'
23
- /* 单选框(可支持配置button形式 */
24
- import ARadio from './components/ARadio.vue'
25
- /* (已下需优化修改) */
26
- /* tag多项展示框(需修改 */
27
- import ATagsInput from './components/ATagsInput.vue'
28
- /* 日期选择框 */
29
- import ARangePicker from './components/ARangePicker.vue'
30
- /* 时间区间框(只单进行一天中的时间段选择 */
31
- import ATimePicker from './components/ATimePicker.vue'
32
- /* 文件上传选择器 */
33
- import AUpload from './components/AUpload.vue'
34
-
35
- const components = {
36
- ACascaderMultiple,
37
- ASelectCustom,
38
- ARadio,
39
- ATagsInput,
40
- ARangePicker,
41
- ATimePicker,
42
- AUpload
43
- }
44
-
45
- const install = function (Vue) {
46
- if (install.installed) return
47
- Object.keys(components).forEach(component => {
48
- Vue.component(components[component].name, components[component])
49
- })
50
- }
51
-
52
- export default {
53
- install,
54
- ...components
55
- }