ylwl-cpscoms 1.0.0

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 (80) hide show
  1. package/README.md +15 -0
  2. package/es/SlAlert/index.vue.js +58 -0
  3. package/es/SlAlert/index.vue2.js +37 -0
  4. package/es/SlAlert/index.vue3.js +6 -0
  5. package/es/SlDescriptions/index.vue.js +55 -0
  6. package/es/SlDescriptions/index.vue2.js +57 -0
  7. package/es/SlDescriptions/index.vue3.js +6 -0
  8. package/es/SlDescriptions/renderOptions.vue.js +25 -0
  9. package/es/SlDescriptions/renderOptions.vue2.js +31 -0
  10. package/es/SlDialog/dialogPlus.js +159 -0
  11. package/es/SlDialog/index.js +202 -0
  12. package/es/SlDrawer/index.js +54 -0
  13. package/es/SlForm/index.vue.js +26 -0
  14. package/es/SlForm/index.vue2.js +433 -0
  15. package/es/SlForm/index.vue3.js +6 -0
  16. package/es/SlForm/mixinRender.js +239 -0
  17. package/es/SlForm/otherItem/titleItem.vue.js +39 -0
  18. package/es/SlForm/otherItem/titleItem.vue2.js +20 -0
  19. package/es/SlForm/otherItem/titleItem.vue3.js +6 -0
  20. package/es/SlGuide/index.vue.js +38 -0
  21. package/es/SlGuide/index.vue2.js +133 -0
  22. package/es/SlGuide/index.vue3.js +6 -0
  23. package/es/SlGuide/index.vue4.js +6 -0
  24. package/es/SlMessageBox/index.js +46 -0
  25. package/es/SlPage/index.vue.js +147 -0
  26. package/es/SlPage/index.vue2.js +312 -0
  27. package/es/SlPage/index.vue3.js +6 -0
  28. package/es/SlTable/components/colSetting.vue.js +94 -0
  29. package/es/SlTable/components/colSetting.vue2.js +66 -0
  30. package/es/SlTable/components/colSetting.vue3.js +6 -0
  31. package/es/SlTable/index.vue.js +171 -0
  32. package/es/SlTable/index.vue2.js +390 -0
  33. package/es/SlTable/index.vue3.js +6 -0
  34. package/es/SlTitle/index.vue.js +41 -0
  35. package/es/SlTitle/index.vue2.js +26 -0
  36. package/es/SlTitle/index.vue3.js +6 -0
  37. package/es/_virtual/_rollupPluginBabelHelpers.js +247 -0
  38. package/es/index.js +41 -0
  39. package/es/node_modules/shepherd.js/dist/css/shepherd.css.js +7 -0
  40. package/es/node_modules/style-inject/dist/style-inject.es.js +28 -0
  41. package/es/node_modules/vue-runtime-helpers/dist/normalize-component.js +76 -0
  42. package/es/utils/index.js +51 -0
  43. package/package.json +106 -0
  44. package/src/SlAlert/SlAlert.stories.js +108 -0
  45. package/src/SlAlert/index.vue +54 -0
  46. package/src/SlAlert/remark.md +16 -0
  47. package/src/SlDescriptions/SlDescriptions.stories.js +119 -0
  48. package/src/SlDescriptions/index.vue +60 -0
  49. package/src/SlDescriptions/renderOptions.vue +27 -0
  50. package/src/SlDialog/README-PLUS.md +74 -0
  51. package/src/SlDialog/README.md +114 -0
  52. package/src/SlDialog/dialogPlus.js +160 -0
  53. package/src/SlDialog/index.js +170 -0
  54. package/src/SlDrawer/SlDrawer.stories.js +154 -0
  55. package/src/SlDrawer/index.js +62 -0
  56. package/src/SlForm/SlForm.stories.js +120 -0
  57. package/src/SlForm/index.css +141 -0
  58. package/src/SlForm/index.vue +365 -0
  59. package/src/SlForm/mixinRender.js +228 -0
  60. package/src/SlForm/otherItem/titleItem.vue +31 -0
  61. package/src/SlForm/remark.md +607 -0
  62. package/src/SlGuide/SlGuide.stories.js +100 -0
  63. package/src/SlGuide/index.vue +166 -0
  64. package/src/SlGuide/remark.md +90 -0
  65. package/src/SlMessageBox/index.js +35 -0
  66. package/src/SlPage/README.md +515 -0
  67. package/src/SlPage/SlPage.stories.js +125 -0
  68. package/src/SlPage/index.css +38 -0
  69. package/src/SlPage/index.vue +266 -0
  70. package/src/SlPage/remark.md +283 -0
  71. package/src/SlTable/SlTable.stories.js +118 -0
  72. package/src/SlTable/components/colSetting.vue +86 -0
  73. package/src/SlTable/index.vue +541 -0
  74. package/src/SlTitle/SlTitle.stories.js +98 -0
  75. package/src/SlTitle/index.vue +49 -0
  76. package/src/global.css +5 -0
  77. package/src/index.js +47 -0
  78. package/src/store/index.js +20 -0
  79. package/src/utils/index.js +47 -0
  80. package/src/utils/tableConfig.js +33 -0
@@ -0,0 +1,365 @@
1
+ <script>
2
+ import { typeOf, hasKey, filterKey, transformName } from '@/components/global/utils'
3
+ import EL from 'element-ui'
4
+ import mixinRender from './mixinRender'
5
+
6
+ export default {
7
+ name: 'SlForm',
8
+ mixins: [mixinRender],
9
+ props: {
10
+ value: { type: Object, default: () => ({}) },
11
+ itemWidth: { type: String, default: '' },
12
+ data: { type: Array, default: () => [] },
13
+ showlabel: { type: Boolean, default: true },
14
+ drawer: { type: Boolean, default: false }, // 开启抽屉模式
15
+ formProps: { type: Object, default: () => ({ inline: true }) },
16
+ formItemProps: { type: Object, default: () => ({}) },
17
+ pipe: { type: Object, default: () => ({}) }, // 动态管道
18
+ freeData: { type: Object, default: () => ({}) }, // 游离的数据(将会合并到form一起返回)
19
+ initItem: { type: Function, default: () => {} } // 初始化item的值
20
+ },
21
+ data() {
22
+ const state = this.formateState()
23
+ return {
24
+ ...state,
25
+ isDrawerOpen: true,
26
+ boxHeight: 'auto',
27
+ firstitemHeight: '0',
28
+ selectOptions: {}, // 实时渲染的selectOptions
29
+ selectAllOptions: {}, // 初始化好的Select的Options
30
+ aggGameId: '123456'
31
+ }
32
+ },
33
+ mounted() {
34
+ // console.log('mounted', this.form)
35
+ this.$emit('input', this.form)
36
+ this.initFirstHieght()
37
+ },
38
+ methods: {
39
+ // 重置
40
+ reset() {
41
+ const { form, transfer } = JSON.parse(
42
+ JSON.stringify(this.catchInitValueData)
43
+ )
44
+ this.form = form
45
+ this.transfer = transfer
46
+ this.$emit('input', this.form)
47
+ },
48
+ initFirstHieght() {
49
+ const { offsetHeight = 0 } = (this.$refs.firstItem || {}).$el || {}
50
+ this.firstitemHeight = offsetHeight + 20 + 'px'
51
+ },
52
+ formateState() {
53
+ const { data, freeData } = this.$props
54
+ const form = { ...freeData }
55
+ const transfer = {}
56
+ const initData = data.reduce((pre, item) => {
57
+ // debugger
58
+ if (hasKey(item, ['model', 'type'])) {
59
+ !item.props && (item.props = {})
60
+ item = this.initItem(item) || item
61
+ const { callback, model, value } = item
62
+ const dispersed = typeOf(callback, 'function') // 是否离散键(拆分model键)
63
+
64
+ const target = dispersed ? transfer : form //
65
+ const valueSource = target[model] !== undefined ? target[model] : this.$props.value[model] !== undefined ? this.$props.value[model] : value !== undefined ? value : ''
66
+ if (dispersed) {
67
+ const res = callback(valueSource || '') || {}
68
+ Object.keys(res).forEach((key) => {
69
+ res[key] === undefined && (res[key] = '')
70
+ // console.log(!hasKey(form, [key]), "form[key],", form, key, [key])
71
+ !hasKey(form, [key]) && (form[key] = res[key] || '')
72
+ })
73
+ }
74
+ // console.log(valueSource, "valueSource", !hasKey(target, [model]))
75
+ !hasKey(target, [model]) && (target[model] = valueSource)
76
+ pre.push(item)
77
+ // if (item.show === undefined || item.show === null) pre.push(item)
78
+ // else if (typeOf(item.show, 'function') && item.show()) pre.push(item)
79
+ // else if (typeOf(item.show, 'boolean') && item.show) pre.push(item)
80
+ }
81
+ return pre
82
+ }, [])
83
+
84
+ // console.log(initData, "initData")
85
+ setTimeout(() => {
86
+ // 初始化后再watch
87
+ initData.forEach((...p) => this.watchValue(...p))
88
+ })
89
+ // const aaa = {
90
+ // form,
91
+ // transfer,
92
+ // initData,
93
+ // catchInitValueData: {
94
+ // form: JSON.parse(JSON.stringify(form)),
95
+ // transfer: JSON.parse(JSON.stringify(transfer))
96
+ // }
97
+ // }
98
+ // console.log(aaa, "zxckxzcnxzkjc")
99
+ return {
100
+ form,
101
+ transfer,
102
+ initData,
103
+ catchInitValueData: {
104
+ form: JSON.parse(JSON.stringify(form)),
105
+ transfer: JSON.parse(JSON.stringify(transfer))
106
+ }
107
+ }
108
+ },
109
+ // 联动变化监听
110
+ watchValue(item, i, ary) {
111
+ const { callback, model, linkSet } = item
112
+ if (typeOf(linkSet, 'function')) {
113
+ const dispersed = typeOf(callback, 'function')
114
+ const target = dispersed ? this.transfer : this.form
115
+ const targetstr = dispersed ? 'transfer' : 'form'
116
+ const watchCallback = async function(val) {
117
+ let getInfo = (await linkSet(val || '')) || {}
118
+ if (!Array.isArray(getInfo)) {
119
+ getInfo = [getInfo]
120
+ }
121
+ getInfo.forEach((setItem) => {
122
+
123
+ this.$set(this.selectOptions, setItem.model, setItem.options || [])
124
+ let nextItem = {}
125
+ const tindex = ary.findIndex((item1) => {
126
+ const flag = item1.model === setItem.model
127
+ flag && (nextItem = item1)
128
+ return flag
129
+ })
130
+ console.log('watchCallback', setItem, nextItem, ary, tindex, '----', this.initData)
131
+ const nextTarget = typeOf(nextItem.callback, 'function')
132
+ ? this.transfer
133
+ : this.form
134
+ hasKey(setItem, 'value') &&
135
+ (nextTarget[setItem.model] = setItem.value)
136
+ tindex !== -1 && this.$set(
137
+ ary,
138
+ tindex,
139
+ Object.assign(ary[tindex], setItem)
140
+ )
141
+ console.log('watchCallback22222', this.initData, ary)
142
+ // this.initData = ary.filter((item) => {
143
+ // console.log('watchCallback44444', item)
144
+ // if ((item.show === undefined || item.show === null) || (typeOf(item.show, 'function') && item.show()) || (typeOf(item.show, 'boolean') && item.show)) {
145
+ // nextTarget[setItem.model] = ''
146
+ // return true
147
+ // }
148
+ // return false
149
+ // })
150
+ console.log('watchCallback333333', this.initData)
151
+ })
152
+
153
+ }
154
+ this.$watch(`${targetstr}.${model}`, watchCallback)
155
+ watchCallback.call(this, target[model]) // 首次进行绑定执行
156
+ }
157
+ },
158
+ fomateValue(item, value = item.value) {
159
+ const { callback } = item
160
+ console.log('fomateValue', typeOf(callback, 'function'), this.form)
161
+ if (typeOf(callback, 'function')) {
162
+ this.transfer[item.model] = value
163
+ const res = callback(value || '') || {}
164
+ // console.log(res, 'res')
165
+ Object.keys(res).forEach((key) => {
166
+ res[key] === undefined && (res[key] = '')
167
+ })
168
+ Object.assign(this.form, res)
169
+ console.log(this.form, 'this.form')
170
+ } else {
171
+ if (item.type === 'input') {
172
+ this.form[item.model] = value.replace(/^[ \t]+|[ \t]+$/g, '');
173
+ } else {
174
+ this.form[item.model] = value
175
+ }
176
+ }
177
+ },
178
+ validate() {
179
+ return this.$refs.form.validate()
180
+ },
181
+ // 提交表单
182
+ submit() {
183
+ return new Promise((res, rej) => {
184
+ this.$refs.form.validate((isOk, msg) => {
185
+ if (isOk) {
186
+ res(this.form)
187
+ } else {
188
+ rej(msg)
189
+ }
190
+ })
191
+ })
192
+ },
193
+
194
+ setItemValue(item) {
195
+ const target = item.callback ? this.transfer : this.form
196
+ target[item.model] = item.value
197
+ },
198
+ initCommonProps(item, filters = [], privateProps = {}, privateAttrs = {}) {
199
+ const target = item.callback ? this.transfer : this.form
200
+ // console.log('initCommonProps', item, target, this.value, item.callback ? '1' : '2', this.form)
201
+ // this.form[item.model] = ''
202
+ // console.log(this.form, 'this.form111', filterKey(item.props, filters), privateProps)
203
+ const { itemWidth, showlabel } = this.$props
204
+ return {
205
+ style: `width:${showlabel ? '100%' : item.width || itemWidth};${
206
+ item.style
207
+ }`,
208
+ props: Object.assign(
209
+ {
210
+ value: this.form[item.model],
211
+ clearable: true,
212
+ filterable: true,
213
+ placeholder: showlabel ? '请输入' + item.label : item.label
214
+ },
215
+ filterKey(item.props, filters),
216
+ privateProps
217
+ ),
218
+ attrs: { placeholder: showlabel ? '请输入' + item.label : item.label, ...privateAttrs },
219
+ on: {
220
+ input: (value) => {
221
+ this.fomateValue(item, value)
222
+ }
223
+ }
224
+ }
225
+ },
226
+ initOptions(item) {
227
+ if (item.asycnOptions && typeOf(item.asycnOptions, 'function')) {
228
+ // console.log(item.asycnOptions, 'it-----em')
229
+ item.asycnOptions().then(result => {
230
+ // console.log(result, "result")
231
+ this.$set(this.selectOptions, item.model, result || [])
232
+ })
233
+ } else {
234
+ this.$set(this.selectOptions, item.model, item.options || [])
235
+ }
236
+ }
237
+ },
238
+ created() {
239
+ this.initData.forEach((item) => {
240
+ if (['select', 'checkbox', 'radio'].includes(item.type)) {
241
+ this.initOptions(item)
242
+ }
243
+ })
244
+ },
245
+
246
+ render(ce) {
247
+ const { showlabel, itemWidth, drawer } = this.$props
248
+ // console.log('render', this.initData)
249
+ const updateInitData = this.initData.filter((item) => {
250
+ if ((item.show === undefined || item.show === null) || (typeOf(item.show, 'function') && item.show()) || (typeOf(item.show, 'boolean') && item.show)) {
251
+ return true
252
+ }
253
+ return false
254
+ })
255
+ const formItems = updateInitData.map((item, ii) => {
256
+ const { label, model, rules, type, width, labelTips } = item
257
+ if (type === 'title') {
258
+ return this.renderTitle(ce, item)
259
+ }
260
+ // console.log(item, "itexxxxxxm", this)
261
+ if (type === 'slot' && item.slotName && this.$slots[item.slotName]) {
262
+ return ce('div', {
263
+ class: 'yl-form-slot-container',
264
+ style: item.style || ''
265
+ }, this.$slots[item.slotName])
266
+ }
267
+
268
+ const itemBody = [this[`render${transformName(type)}`](ce, item)]
269
+ const itemClass = `yl-form-item ${showlabel ? '' : 'yl-form-fullitem'} ${
270
+ item.className || ''
271
+ }`
272
+ // if (!showlabel) {
273
+ // itemBody.unshift(ce('div', { class: 'yl-i-lebel' }, label))
274
+ // itemClass += 'yl-form-item-grid'
275
+ // }
276
+ if (
277
+ item.rules &&
278
+ item.rules.find(({ required }) => required) &&
279
+ !showlabel
280
+ ) {
281
+ itemBody.unshift(ce('span', { class: 'yl-r-icon' }, '*'))
282
+ }
283
+ const itemSet = {
284
+ class: itemClass,
285
+ style: `width:${width || itemWidth};${item.style}`,
286
+ props: Object.assign(
287
+ { label: showlabel ? label : '', prop: model, rules },
288
+ this.formItemProps
289
+ ),
290
+ scopedSlots: {
291
+ label: () =>
292
+ ce(
293
+ 'span',
294
+ { style: 'label-container' },
295
+ [
296
+ labelTips ? ce(
297
+ 'el-tooltip',
298
+ {
299
+ props: {
300
+ content: labelTips,
301
+ placement: 'top'
302
+ }
303
+ },
304
+ [
305
+ ce(
306
+ 'i',
307
+ { class: 'el-icon-info' },
308
+ []
309
+ )
310
+ ]
311
+ ) : '',
312
+ ce(
313
+ 'span',
314
+ { class: 'item-label', domProps: { title: label }, style: 'margin-left: 5px;' },
315
+ label + ':'
316
+ )
317
+ ]
318
+ )
319
+ }
320
+ }
321
+ ii === 0 && (itemSet.ref = 'firstItem')
322
+ const ft = ce(EL.FormItem, itemSet, itemBody)
323
+ return ft
324
+ })
325
+ // console.log(this, "this.$scopedSlots.default")
326
+ if (this.$slots.default || drawer) {
327
+ const element = []
328
+ // this.$slots.default &&
329
+ // element.push(this.$slots.default(this.form))
330
+ drawer && element.push(this.renderDrawer(ce))
331
+ formItems.push(
332
+ ce(
333
+ 'div',
334
+ {
335
+ class: `yl-form-drawericon ${
336
+ this.isDrawerOpen ? '' : 'yl-form-drawericon-float'
337
+ }`
338
+ },
339
+ this.$slots.default
340
+ )
341
+ )
342
+ }
343
+ // console.log(this.formProps, "this.formProps")
344
+ return ce(
345
+ EL.Form,
346
+ {
347
+ class: {
348
+ 'yl-form-box': true,
349
+ 'yl-form-box-shrink': !this.isDrawerOpen,
350
+ 'yl-form-box-inline': this.formProps.inline
351
+ },
352
+ style: `height:${this.boxHeight}`,
353
+ props: Object.assign({ model: this.form }, this.formProps),
354
+ ref: 'form',
355
+ nativeOn: { submit: (e) => e.preventDefault() }
356
+ },
357
+ formItems
358
+ )
359
+ }
360
+ }
361
+ </script>
362
+
363
+ <style scoped >
364
+ @import url('./index.css');
365
+ </style>
@@ -0,0 +1,228 @@
1
+ import titleItem from '@/components/global/SlForm/otherItem/titleItem.vue'
2
+ import EL from 'element-ui'
3
+ import { typeOf } from '@/components/global/utils'
4
+ export default {
5
+ components: {
6
+ titleItem
7
+ },
8
+ methods: {
9
+ renderTitle(ce, item) {
10
+ return ce(titleItem, {
11
+ props: {
12
+ item
13
+ }
14
+
15
+ })
16
+ },
17
+ renderSwitch(ce, item) {
18
+ return ce(EL.Switch, {
19
+ ...this.initCommonProps(item)
20
+ })
21
+ },
22
+ renderDrawer(ce) {
23
+ return ce(
24
+ EL.Button,
25
+ {
26
+ props: {
27
+ icon: this.isDrawerOpen ? 'el-icon-top-right' : 'el-icon-rank',
28
+ type: 'primary'
29
+ },
30
+ on: {
31
+ click: () => {
32
+ this.isDrawerOpen = !this.isDrawerOpen
33
+ this.boxHeight = this.isDrawerOpen ? 'auto' : this.firstitemHeight
34
+ }
35
+ }
36
+ }
37
+ // this.isDrawerOpen ? 'shrink' : 'open'
38
+ )
39
+ },
40
+ renderText(ce, item) {
41
+ return ce('div', { style: { width: '100%' }}, this.form[item.model])
42
+ },
43
+ renderInput(ce, item) {
44
+ return ce('div', { style: { width: '100%' }}, [
45
+ ce(EL.Input, {
46
+ ...this.initCommonProps(item, [], {}, item.privateAttrs)
47
+ }),
48
+ ce('div', { style: { color: 'red', lineHeight: 2, fontSize: '12px' }}, item.remark)
49
+ ])
50
+ // return ce(EL.Input, {
51
+ // ...this.initCommonProps(item, [], {}, item.privateAttrs)
52
+ // })
53
+ },
54
+ renderInputNumber(ce, item) {
55
+ return ce('div', { style: { width: item.privateAttrs && item.privateAttrs.style && item.privateAttrs.style.width ? item.privateAttrs.style.width : '90%' }}, [
56
+ ce(EL.InputNumber, {
57
+ ...this.initCommonProps(item, [], { 'controls-position': 'right' }, item.privateAttrs)
58
+ }),
59
+ ce('span', { style: { marginLeft: '10px' }}, item.privateAttrs && item.privateAttrs.unit ? item.privateAttrs.unit : ''),
60
+ ce('div', { style: { color: 'red', lineHeight: 2, fontSize: '12px' }}, item.remark)
61
+ ])
62
+ // return ce(EL.Input, {
63
+ // ...this.initCommonProps(item, [], {}, item.privateAttrs)
64
+ // })
65
+ },
66
+ renderSelect(ce, item) {
67
+ const {
68
+ labelKey = 'label',
69
+ valueKey = 'value',
70
+ // options,
71
+ // remoteMethod,
72
+ // props = {},
73
+ model,
74
+ slots
75
+ // asycnOptions
76
+ // label
77
+ } = item
78
+ // const isopstr = typeOf(options, 'string')
79
+ // const isopsFun = typeOf(asycnOptions, 'function')
80
+ // const isremote = typeOf(remoteMethod, 'function')
81
+ // const op = (isopsFun ? (await asycnOptions()) : options) || []
82
+ // console.log(this.selectOptions, "this.selectOptions")
83
+ // if (isopsFun) {
84
+ // asycnOptions().then(result => {
85
+ // this.$set(this.selectOptions, model, result || [])
86
+ // // return result || []
87
+ // })
88
+ // } else {
89
+ // this.$set(this.selectOptions, model, options || [])
90
+ // }
91
+ const customOp = this.initCommonProps(
92
+ item,
93
+ ['options', 'labelKey', 'valueKey'],
94
+ {
95
+ hitable: true,
96
+ defaultFirstOption: true
97
+ },
98
+ item.privateAttrs
99
+ )
100
+ const otherSlots = Object.entries(slots || {}).reduce(
101
+ (pre, [key, fun]) => {
102
+ typeOf(fun, 'function') &&
103
+ (pre[key] = () => {
104
+ return fun(ce)
105
+ })
106
+ return pre
107
+ },
108
+ {}
109
+ )
110
+ // return ce(bstSelect.SelectPro, {
111
+ return ce(EL.Select, {
112
+ ...customOp,
113
+ scopedSlots: {
114
+ default: () => {
115
+ return this.selectOptions[model] && this.selectOptions[model].length ? this.selectOptions[model].map((o) =>
116
+ // ce(bstSelect.SelectOption, {
117
+ ce(EL.Option, {
118
+ props: Object.assign({}, o, {
119
+ key: 'id',
120
+ data: o,
121
+ label: o[labelKey],
122
+ value: o[valueKey]
123
+ })
124
+ })
125
+ ) : []
126
+ // return op.map(o=>ce(EL.Option,{props:Object.assign({},o,{key:'id',data:o,label:o[labelKey],value:o[valueKey]})}))
127
+ },
128
+ ...otherSlots
129
+ }
130
+ })
131
+ },
132
+ renderDatePicker(ce, item) {
133
+ return ce(EL.DatePicker, {
134
+ ...this.initCommonProps(item, [], {
135
+ startPlaceholder: '开始时间',
136
+ endPlaceholder: '结束时间',
137
+ defaultTime: item.privateProps && item.privateProps.type === 'daterange' ? ['00:00:00', '23:59:59'] : undefined,
138
+ ...item.privateProps
139
+ }, item.privateProps)
140
+ })
141
+ },
142
+
143
+ renderRadio(ce, item) {
144
+ const { labelKey = 'label', valueKey = 'value', model } = item
145
+ return ce(
146
+ EL.RadioGroup,
147
+ {
148
+ ...this.initCommonProps(item, [
149
+ 'options',
150
+ 'labelKey',
151
+ 'valueKey',
152
+ 'label'
153
+ ])
154
+ },
155
+ this.selectOptions[model] && this.selectOptions[model].length ? this.selectOptions[model].map((o) =>
156
+ ce(EL.Radio, { props: { label: o[valueKey] }}, [o[labelKey]])
157
+ ) : []
158
+ )
159
+ },
160
+
161
+ renderSlider(ce, item) {
162
+ return ce('div', { class: 'yl-form-slider' }, [
163
+ ce('span', { class: 'yl-form-slider-span' }, [item.label]),
164
+ ce(EL.Slider, {
165
+ ...this.initCommonProps(item, []),
166
+ style: 'width:200px'
167
+ })
168
+ ])
169
+ },
170
+ renderRangeInput(ce, item) {
171
+ !typeOf(item.value, 'array') && (item.value = [])
172
+ // const target = item.callback ? this.transfer : this.form
173
+ const target = this.form
174
+ const val = target[item.model]
175
+ const style = ''
176
+ // 清空输入框的函数
177
+ const clearInputs = () => {
178
+ this.fomateValue(item, ['', ''])
179
+ }
180
+
181
+ // 检查是否至少有一个输入框有值
182
+ const hasValue = val && (val[0] || val[1])
183
+ return ce('div', { class: 'yl-form-range-input' }, [
184
+ ce('span', { class: 'yl-form-slider-span' }, [item.label]),
185
+ ce('input', {
186
+ style,
187
+ domProps: { value: val[0], placeholder: '起始值', type: 'number' },
188
+ on: {
189
+ input: ({ target }) => {
190
+ this.fomateValue(item, [target.value, val[1]])
191
+ // this.$emit("input",this.form);
192
+ }
193
+ }
194
+ }),
195
+ '-',
196
+ ce('input', {
197
+ style,
198
+ domProps: { value: val[1], placeholder: '截止值', type: 'number' },
199
+ on: {
200
+ input: ({ target }) => {
201
+ this.fomateValue(item, [val[0], target.value])
202
+ // this.$emit("input",this.form);
203
+ }
204
+ }
205
+ }),
206
+ hasValue && ce('button', {
207
+ class: 'range-input-clear-btn',
208
+ attrs: { type: 'button' },
209
+ style: {
210
+ marginLeft: '5px',
211
+ background: 'none',
212
+ border: 'none',
213
+ fontSize: '16px',
214
+ cursor: 'pointer',
215
+ color: '#999'
216
+ },
217
+ on: {
218
+ click: (e) => {
219
+ e.stopPropagation()
220
+ clearInputs()
221
+ }
222
+ }
223
+ }, '×')
224
+ ])
225
+ }
226
+
227
+ }
228
+ }
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <h3 class="title-item">
3
+ {{ item.label }}
4
+ </h3>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ name: 'TitleItem',
9
+ props: {
10
+ item: {
11
+ type: Object,
12
+ default: () => {}
13
+ }
14
+ },
15
+ mounted() {
16
+ // console.log(this.item, "你的手")
17
+ }
18
+ }
19
+ </script>
20
+ <style scoped>
21
+ .title-item::before {
22
+ content: "|";
23
+ width: 3px;
24
+ background-color: #409EFF;
25
+ color: #409EFF;
26
+ }
27
+ .title-item {
28
+ margin-bottom: 20px;
29
+ }
30
+ </style>
31
+