el-plus-crud 0.1.48 → 0.1.49
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/CHANGELOG.md +3 -5
- package/dist/el-plus-crud.mjs +1348 -1336
- package/lib/components/el-plus-form/ElPlusFormGroup.vue +8 -1
- package/lib/components/el-plus-form/components/ElPlusFormFormula.vue +2 -1
- package/lib/components/el-plus-form/components/ElPlusFormPercentinput.vue +26 -3
- package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +1 -1
- package/package.json +1 -1
|
@@ -160,6 +160,13 @@ async function clearValid() {
|
|
|
160
160
|
return await Promise.all(formRefs.value.map((tempRef) => tempRef.clearValid()))
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* 清空表单
|
|
165
|
+
*/
|
|
166
|
+
async function clear() {
|
|
167
|
+
return await Promise.all(formRefs.value.map((tempRef) => tempRef.clear()))
|
|
168
|
+
}
|
|
169
|
+
|
|
163
170
|
/**
|
|
164
171
|
* 获取数据
|
|
165
172
|
*/
|
|
@@ -171,7 +178,7 @@ function getData() {
|
|
|
171
178
|
return tempData
|
|
172
179
|
}
|
|
173
180
|
|
|
174
|
-
defineExpose({ validate, getData, clearValid })
|
|
181
|
+
defineExpose({ validate, getData, clearValid, clear })
|
|
175
182
|
</script>
|
|
176
183
|
<style lang="scss">
|
|
177
184
|
.el-plus-form-group {
|
|
@@ -228,7 +228,7 @@ function refreshValue() {
|
|
|
228
228
|
divList.map((item: any, i: number) => {
|
|
229
229
|
str = str.replace(item, '${' + yzList[i] + '}')
|
|
230
230
|
})
|
|
231
|
-
currentValue.value = str.replaceAll(' ', '')
|
|
231
|
+
currentValue.value = str.replaceAll(' ', '').replaceAll('<', '<').replaceAll('>', '>')
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/**
|
|
@@ -306,6 +306,7 @@ onUnmounted(() => {
|
|
|
306
306
|
margin-bottom: 20px;
|
|
307
307
|
color: var(--el-color-danger);
|
|
308
308
|
min-height: 25px;
|
|
309
|
+
word-break: break-all;
|
|
309
310
|
}
|
|
310
311
|
.title-tip {
|
|
311
312
|
margin-bottom: 20px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-input style="display: flex" v-bind="attrs" v-on="onEvents" v-model="currentText" @focus="handelFocus" @blur="handelBlur" onkeypress="return event.target.value === '' || event.target.value === undefined || event.target.value?.indexOf('.') >= 0 ? /[-\d]/.test(String.fromCharCode(event.keyCode)): /[-\d\.]/.test(String.fromCharCode(event.keyCode))">
|
|
2
|
+
<el-input style="display: flex" v-bind="attrs" :disabled="disabled" v-on="onEvents" v-model="currentText" @focus="handelFocus" @blur="handelBlur" onkeypress="return event.target.value === '' || event.target.value === undefined || event.target.value?.indexOf('.') >= 0 ? /[-\d]/.test(String.fromCharCode(event.keyCode)): /[-\d\.]/.test(String.fromCharCode(event.keyCode))">
|
|
3
3
|
<template v-for="(item, key, index) of slots" #[key] :key="index">
|
|
4
4
|
<slot :name="key" />
|
|
5
5
|
</template>
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
17
|
<script lang="ts" setup>
|
|
18
|
-
import { ref, useAttrs, useSlots, onBeforeMount, nextTick, computed } from 'vue'
|
|
18
|
+
import { ref, useAttrs, useSlots, onBeforeMount, nextTick, computed, watch } from 'vue'
|
|
19
19
|
import { getAttrs, getEvents } from '../mixins'
|
|
20
20
|
import { ElMessage } from 'element-plus'
|
|
21
21
|
|
|
@@ -23,6 +23,7 @@ const props = defineProps<{
|
|
|
23
23
|
modelValue?: number | null
|
|
24
24
|
field: string
|
|
25
25
|
desc: { [key: string]: any }
|
|
26
|
+
disabled?: boolean
|
|
26
27
|
formData: { [key: string]: any }
|
|
27
28
|
}>()
|
|
28
29
|
const emits = defineEmits(['update:modelValue', 'validateThis'])
|
|
@@ -81,7 +82,7 @@ function handelBlur() {
|
|
|
81
82
|
const numBindAttr = computed(() => {
|
|
82
83
|
let min = 0
|
|
83
84
|
let max = 100
|
|
84
|
-
let precision =
|
|
85
|
+
let precision = 5
|
|
85
86
|
|
|
86
87
|
let tempAttrs = props.desc?.attrs || props.desc
|
|
87
88
|
if (props.desc?.attrs && typeof props.desc.attrs === 'function') {
|
|
@@ -144,10 +145,32 @@ function handelValChange(val: any, oldVal: any) {
|
|
|
144
145
|
} else {
|
|
145
146
|
if (val.indexOf('.') > 0 && val.length - val.indexOf('.') > numBindAttr.value.precision - 2) {
|
|
146
147
|
currentText.value = (+val).toFixed(numBindAttr.value.precision - 2)
|
|
148
|
+
} else {
|
|
149
|
+
currentText.value = val
|
|
147
150
|
}
|
|
148
151
|
currentValue.value = +(val / 100).toFixed(numBindAttr.value.precision)
|
|
149
152
|
change && change()
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 清空数据
|
|
159
|
+
*/
|
|
160
|
+
function clear() {
|
|
161
|
+
currentText.value = null
|
|
162
|
+
currentValue.value = null
|
|
163
|
+
isDoChange.value = false
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
watch(
|
|
167
|
+
() => props.modelValue,
|
|
168
|
+
(val: any) => {
|
|
169
|
+
if (val !== undefined && val !== null && val !== '') {
|
|
170
|
+
handelValChange((val * 100).toFixed(numBindAttr.value.precision - 2), null)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
defineExpose({ clear, field: props.field })
|
|
153
176
|
</script>
|
|
@@ -214,7 +214,7 @@ async function getToken(token: string | Object | Function | undefined, param?: a
|
|
|
214
214
|
async function handelUploadSuccess(response: any, file: any) {
|
|
215
215
|
if (response && Object.keys(response).length > 0) {
|
|
216
216
|
// 从结果集中获取一下furl
|
|
217
|
-
const tempUrl = getValue(defaultConf.upload?.actionMap?.objectUrlKey || [], response.request)
|
|
217
|
+
const tempUrl = getValue(defaultConf.upload?.actionMap?.objectUrlKey || [], response.request || response)
|
|
218
218
|
if (tempUrl) file.raw.furl = tempUrl
|
|
219
219
|
}
|
|
220
220
|
// 获取文件上传的token以及上传路径
|