lw-cdp-ui 1.1.6 → 1.1.8
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/dist/components/lwCronSelect/index.vue +26 -32
- package/dist/components/lwForm/index.vue +58 -19
- package/dist/components/lwSvgIcon/index.vue +1 -1
- package/dist/lw-cdp-ui.esm.js +1963 -1922
- package/dist/lw-cdp-ui.esm.js.map +1 -1
- package/dist/lw-cdp-ui.umd.js +12 -12
- package/dist/lw-cdp-ui.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +47 -46
|
@@ -88,13 +88,9 @@
|
|
|
88
88
|
</template>
|
|
89
89
|
|
|
90
90
|
<script>
|
|
91
|
-
|
|
92
|
-
* 秒 分 时 日 月 周
|
|
93
|
-
* *
|
|
94
|
-
*/
|
|
95
|
-
import { defineComponent, ref, computed } from 'vue';
|
|
91
|
+
import { ref, computed } from 'vue';
|
|
96
92
|
|
|
97
|
-
export default
|
|
93
|
+
export default {
|
|
98
94
|
name: 'lwCronSelect',
|
|
99
95
|
props: {
|
|
100
96
|
disabled: Boolean,
|
|
@@ -104,12 +100,19 @@ export default defineComponent({
|
|
|
104
100
|
}
|
|
105
101
|
},
|
|
106
102
|
setup(props, { emit }) {
|
|
103
|
+
// 解析传入的modelValue,生成内部使用的dataList
|
|
107
104
|
const dataList = computed(() => {
|
|
108
105
|
return props.modelValue ? props.modelValue.split(' ') : ['*', '*', '*', '*', '*', '?']
|
|
109
106
|
})
|
|
107
|
+
// 初始化显示的输入值
|
|
110
108
|
const showInput = ref(props.modelValue)
|
|
109
|
+
// 控制弹出框的显示与隐藏
|
|
111
110
|
const visible = ref(false)
|
|
112
111
|
|
|
112
|
+
/**
|
|
113
|
+
* 根据选择的类型重置相关数据
|
|
114
|
+
* @param {number} val - 选择的类型值
|
|
115
|
+
*/
|
|
113
116
|
const changeInt = (val) => {
|
|
114
117
|
switch (val) {
|
|
115
118
|
case 3:
|
|
@@ -131,6 +134,7 @@ export default defineComponent({
|
|
|
131
134
|
setData.value.timeData = ''
|
|
132
135
|
}
|
|
133
136
|
|
|
137
|
+
// 初始化setData对象,用于内部数据管理
|
|
134
138
|
const setData = ref({
|
|
135
139
|
curType: dataList.value[4] !== '*' ? 4 : dataList.value[5] === '?' ? 3 : 5,
|
|
136
140
|
day: dataList.value[3] === '*' ? [] : dataList.value[3]?.split(','),
|
|
@@ -139,26 +143,36 @@ export default defineComponent({
|
|
|
139
143
|
timeData: dataList.value[0] === '*' ? '' : `${dataList.value[2]}:${dataList.value[1]}:${dataList.value[0]}`
|
|
140
144
|
})
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
/**
|
|
147
|
+
* 处理日期选择
|
|
148
|
+
* @param {string} val - 选择的日期值
|
|
149
|
+
*/
|
|
145
150
|
const changeDay = (val) => {
|
|
146
151
|
if (val.indexOf('L') !== -1) {
|
|
147
152
|
setData.value.day = ['L']
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
|
-
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 处理周选择
|
|
158
|
+
* @param {string} val - 选择的周值
|
|
159
|
+
*/
|
|
151
160
|
const changeWeeks = (val) => {
|
|
152
161
|
if (val.indexOf('?') !== -1) {
|
|
153
162
|
setData.value.weeks = ['?']
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
|
|
166
|
+
/**
|
|
167
|
+
* 更新cron表达式
|
|
168
|
+
*/
|
|
157
169
|
const changeCron = () => {
|
|
158
170
|
emit('update:modelValue', showInput.value)
|
|
159
171
|
}
|
|
160
172
|
|
|
161
|
-
|
|
173
|
+
/**
|
|
174
|
+
* 确定选择,生成最终的cron表达式
|
|
175
|
+
*/
|
|
162
176
|
const changeOk = () => {
|
|
163
177
|
console.log(setData.value.timeData)
|
|
164
178
|
const time = setData.value.timeData ? setData.value.timeData.split(':') : ['*', '*', '*']
|
|
@@ -191,25 +205,5 @@ export default defineComponent({
|
|
|
191
205
|
changeWeeks
|
|
192
206
|
}
|
|
193
207
|
}
|
|
194
|
-
});
|
|
195
|
-
</script>
|
|
196
|
-
|
|
197
|
-
<style lang="scss" scoped>
|
|
198
|
-
.CronSelect {
|
|
199
|
-
margin: 5px 0;
|
|
200
|
-
width: 100%;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.select-model {
|
|
204
|
-
display: flex;
|
|
205
|
-
width: 100%;
|
|
206
|
-
|
|
207
|
-
.item-select {
|
|
208
|
-
margin-right: 5px;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
:deep(.arco-popconfirm-icon) {
|
|
213
|
-
display: none;
|
|
214
208
|
}
|
|
215
|
-
</
|
|
209
|
+
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
ref="form"
|
|
7
7
|
:model="form"
|
|
8
8
|
:label-width="config.labelWidth"
|
|
9
|
-
:label-position="config.labelPosition"
|
|
9
|
+
:label-position="$i18n.locale == 'en-us' ? 'top' : config.labelPosition"
|
|
10
10
|
v-loading="loading"
|
|
11
11
|
:disabled="isView"
|
|
12
12
|
element-loading-text="Loading...">
|
|
@@ -204,14 +204,12 @@
|
|
|
204
204
|
<template v-if="item?.options?.name">
|
|
205
205
|
<el-input-number v-model="form[item.name][item.options.name]"
|
|
206
206
|
:disabled="item.options.disabled"
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}"
|
|
214
|
-
controls-position="right">
|
|
207
|
+
:min="item?.options?.min"
|
|
208
|
+
:max="item?.options?.max"
|
|
209
|
+
:step="item?.options?.step || 1"
|
|
210
|
+
:precision="item?.options?.precision"
|
|
211
|
+
:placeholder=" item?.options?.placeholder || ''"
|
|
212
|
+
:controls-position="item?.options?.controlsPosition || 'right'">
|
|
215
213
|
<template v-if="item?.options?.suffix"
|
|
216
214
|
#suffix>
|
|
217
215
|
<span>{{item.options.suffix}}</span>
|
|
@@ -221,14 +219,12 @@
|
|
|
221
219
|
<template v-else>
|
|
222
220
|
<el-input-number v-model="form[item.name]"
|
|
223
221
|
:disabled="item.options.disabled"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}"
|
|
231
|
-
controls-position="right">
|
|
222
|
+
:min="item?.options?.min"
|
|
223
|
+
:max="item?.options?.max"
|
|
224
|
+
:step="item?.options?.step || 1"
|
|
225
|
+
:precision="item?.options?.precision"
|
|
226
|
+
:placeholder=" item?.options?.placeholder || ''"
|
|
227
|
+
:controls-position="item?.options?.controlsPosition || 'right'">
|
|
232
228
|
<template v-if="item?.options?.suffix"
|
|
233
229
|
#suffix>
|
|
234
230
|
<span>{{item.options.suffix}}</span>
|
|
@@ -361,8 +357,46 @@ export default {
|
|
|
361
357
|
},
|
|
362
358
|
props: {
|
|
363
359
|
modelValue: { type: Object, default: () => { } },
|
|
360
|
+
/**
|
|
361
|
+
* 配置项
|
|
362
|
+
* {
|
|
363
|
+
* formItems: [{
|
|
364
|
+
* span: 24,
|
|
365
|
+
* component: 'input', // 可选项有 input, textarea, select, cascader, date, number, radio, checkbox, switch, color, rate, slider, tags, divider, upload, 自定义名称
|
|
366
|
+
* name: 'name', // 表单字段名称
|
|
367
|
+
* label: '名称', // 表单字段名称
|
|
368
|
+
* message: '提示信息', // 表单字段名称
|
|
369
|
+
* value: '1', // 表单字段值
|
|
370
|
+
* options: {
|
|
371
|
+
* name: 'name', // 表单字段名称
|
|
372
|
+
* type: 'input|', // 输入框类型
|
|
373
|
+
* placeholder: '请输入', // 表单字段名称
|
|
374
|
+
* disabled: false, // 表单字段名称
|
|
375
|
+
* maxlength: 10, // 表单字段名称
|
|
376
|
+
* append: '元', // 表单字段名称
|
|
377
|
+
* items: [{
|
|
378
|
+
* value: '1',
|
|
379
|
+
* label: '选项1'
|
|
380
|
+
* }, {
|
|
381
|
+
* value: '2',
|
|
382
|
+
* label: '选项2'
|
|
383
|
+
* }]
|
|
384
|
+
* }
|
|
385
|
+
* ...
|
|
386
|
+
* }]
|
|
387
|
+
* labelWidth: '100px', // 表单域标签的宽度
|
|
388
|
+
* labelPosition: 'top', // 表单域标签的位置,如果值为 left 或者 right 时,则需要设置 label-width
|
|
389
|
+
* ...
|
|
390
|
+
* }
|
|
391
|
+
* **/
|
|
364
392
|
config: { type: Object, default: () => { } },
|
|
393
|
+
/**
|
|
394
|
+
* 是否显示加载中
|
|
395
|
+
*/
|
|
365
396
|
loading: { type: Boolean, default: false },
|
|
397
|
+
/**
|
|
398
|
+
* 是否是查看模式
|
|
399
|
+
*/
|
|
366
400
|
isView: { type: Boolean, default: false },
|
|
367
401
|
},
|
|
368
402
|
data() {
|
|
@@ -404,7 +438,13 @@ export default {
|
|
|
404
438
|
}
|
|
405
439
|
},
|
|
406
440
|
methods: {
|
|
407
|
-
|
|
441
|
+
/**
|
|
442
|
+
* 渲染表单数据。
|
|
443
|
+
* 遍历配置中的表单项,根据不同组件类型初始化表单数据。
|
|
444
|
+
* 对于复选框和上传组件,将选项值存储在对象中。
|
|
445
|
+
* 对于其他组件,直接将值赋给表单数据。
|
|
446
|
+
* 如果存在当前值,则将其与表单数据进行深度合并。
|
|
447
|
+
*/
|
|
408
448
|
render() {
|
|
409
449
|
this.form = {}
|
|
410
450
|
this.config.formItems.forEach((item) => {
|
|
@@ -437,7 +477,6 @@ export default {
|
|
|
437
477
|
this.form = this.deepMerge(this.form, this.modelValue)
|
|
438
478
|
}
|
|
439
479
|
},
|
|
440
|
-
//合并深结构对象
|
|
441
480
|
deepMerge(obj1, obj2) {
|
|
442
481
|
for (let key in obj2) {
|
|
443
482
|
if (obj2.hasOwnProperty(key)) {
|