resolver-egretimp-plus 0.1.111 → 0.1.113
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/h5/index.js +2 -2
- package/dist/theme/element/index.css +1 -1
- package/dist/theme/element/src/components/collapse.scss +5 -3
- package/dist/theme/element/src/components/common.scss +7 -1
- package/dist/theme/element/src/components/form.scss +3 -3
- package/dist/theme/element/src/components/table.scss +16 -3
- package/dist/theme/element/src/index.scss +5 -3
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/components/helper/dock.js +16 -6
- package/src/components/packages-web/CustomComponentCol.vue +8 -10
- package/src/components/packages-web/CustomComponentRow.vue +9 -5
- package/src/components/packages-web/CustomComponentSelectEmployees.vue +1 -0
- package/src/components/packages-web/CustomComponentTable.jsx +41 -8
- package/src/components/simpleFormItemPc/index.js +1 -0
- package/src/components/simpleFormItemPc/src/index.vue +94 -0
- package/src/resolver-web.vue +5 -2
- package/src/theme/element/components/collapse.scss +5 -3
- package/src/theme/element/components/common.scss +7 -1
- package/src/theme/element/components/form.scss +3 -3
- package/src/theme/element/components/table.scss +16 -3
- package/src/theme/element/index.scss +5 -3
- package/src/utils/render.jsx +65 -60
package/package.json
CHANGED
|
@@ -78,15 +78,25 @@ export const getFeiShuTokensApi = async (params) => {
|
|
|
78
78
|
|
|
79
79
|
// https://cmitry.feishu.cn/docs/doccnCtL96HOryMUErjXBMBrn4c#
|
|
80
80
|
// 选人选部门Select组件(原生js版本)
|
|
81
|
-
let
|
|
81
|
+
let tokenAxiosInstance = null
|
|
82
|
+
|
|
82
83
|
export const useSelEmployeeJs = () => {
|
|
83
84
|
const getToken = async () => {
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
let currentAxiosInstance = tokenAxiosInstance
|
|
86
|
+
if (!currentAxiosInstance) {
|
|
87
|
+
currentAxiosInstance = getFeiShuTokensApi({ "busiType": "CONSULTING_HELP" })
|
|
88
|
+
tokenAxiosInstance = currentAxiosInstance
|
|
89
|
+
}
|
|
90
|
+
let ret = null
|
|
91
|
+
try {
|
|
92
|
+
ret = await currentAxiosInstance
|
|
93
|
+
} catch (error) {
|
|
94
|
+
tokenAxiosInstance = null
|
|
95
|
+
ret = null
|
|
96
|
+
}
|
|
97
|
+
if (ret) {
|
|
98
|
+
return ret?.data?.result
|
|
86
99
|
}
|
|
87
|
-
let { data: { result } } = await getFeiShuTokensApi({ "busiType": "CONSULTING_HELP" })
|
|
88
|
-
token = result
|
|
89
|
-
return result
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
const loadStyle = async () => {
|
|
@@ -45,23 +45,21 @@ const reserveBottomMargin = computed(() => {
|
|
|
45
45
|
})
|
|
46
46
|
</script>
|
|
47
47
|
<style lang="scss">
|
|
48
|
-
.custom-component-row {
|
|
49
|
-
.el-col {
|
|
50
|
-
& > .el-form-item {
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
48
|
.clear-right-margin {
|
|
55
49
|
.el-col {
|
|
56
|
-
& >
|
|
57
|
-
|
|
50
|
+
& > {
|
|
51
|
+
.el-form-item, .simple-form-item {
|
|
52
|
+
margin-right: 0;
|
|
53
|
+
}
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
.clear-bottom-margin {
|
|
62
58
|
.el-col {
|
|
63
|
-
& >
|
|
64
|
-
|
|
59
|
+
& > {
|
|
60
|
+
.el-form-item, .simple-form-item {
|
|
61
|
+
margin-bottom: 0;
|
|
62
|
+
}
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -47,7 +47,7 @@ const reserveBottomMargin = computed(() => {
|
|
|
47
47
|
})
|
|
48
48
|
</script>
|
|
49
49
|
<style lang="scss">
|
|
50
|
-
.el-form-item__content {
|
|
50
|
+
.el-form-item__content, simple-form-item-content {
|
|
51
51
|
& > .custom-component-row {
|
|
52
52
|
width: 100%;
|
|
53
53
|
}
|
|
@@ -61,8 +61,10 @@ const reserveBottomMargin = computed(() => {
|
|
|
61
61
|
}
|
|
62
62
|
.clear-right-margin {
|
|
63
63
|
.el-col {
|
|
64
|
-
& >
|
|
65
|
-
|
|
64
|
+
& > {
|
|
65
|
+
.el-form-item, .simple-form-item {
|
|
66
|
+
margin-right: 0;
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -71,8 +73,10 @@ const reserveBottomMargin = computed(() => {
|
|
|
71
73
|
}
|
|
72
74
|
.clear-bottom-margin {
|
|
73
75
|
.el-col {
|
|
74
|
-
& >
|
|
75
|
-
|
|
76
|
+
& > {
|
|
77
|
+
.el-form-item, .simple-form-item {
|
|
78
|
+
margin-bottom: 0;
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
}
|
|
@@ -23,23 +23,55 @@ export default {
|
|
|
23
23
|
triggerRef: null,
|
|
24
24
|
content: ''
|
|
25
25
|
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
// let pageSize = 10 // 默认每页5条
|
|
28
|
+
// if (props.config?.pageSize) {
|
|
29
|
+
// pageSize = parseInt(props.config.pageSize) || 5
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
const defaultPageablePageSize = computed({
|
|
33
|
+
get() {
|
|
34
|
+
return parseInt(props.config.defaultPageablePageSize) || 10 // 默认每页5条
|
|
35
|
+
},
|
|
36
|
+
set(val) {
|
|
37
|
+
props.config.defaultPageablePageSize = val
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
const pageSize = computed({
|
|
41
|
+
get() {
|
|
42
|
+
if (defaultPageable.value) {
|
|
43
|
+
return defaultPageablePageSize.value
|
|
44
|
+
}
|
|
45
|
+
return parseInt(props.config.pageSize) || 5 // 默认每页5条
|
|
46
|
+
},
|
|
47
|
+
set(val) {
|
|
48
|
+
if (defaultPageable.value) {
|
|
49
|
+
defaultPageablePageSize.value = val
|
|
50
|
+
}
|
|
51
|
+
props.config.pageSize = val
|
|
52
|
+
}
|
|
53
|
+
})
|
|
30
54
|
const page = reactive({
|
|
31
55
|
pageNum: 1,
|
|
32
56
|
pageSize,
|
|
33
57
|
total: 0,
|
|
34
58
|
})
|
|
59
|
+
|
|
60
|
+
// 在数据量超过10的话,默认开启分页功能
|
|
61
|
+
const defaultPageable = computed(() => {
|
|
62
|
+
return !(props.config?.frontPageFlag == '1' || props.config?.pageable == '1') && modelValue.value?.length > 10
|
|
63
|
+
})
|
|
64
|
+
|
|
35
65
|
// 开启前端分页
|
|
36
66
|
const isFrontPage = computed(() => {
|
|
37
|
-
return props.config?.frontPageFlag == '1'
|
|
67
|
+
return (props.config?.frontPageFlag == '1' || defaultPageable.value) && !isVirtualized.value
|
|
38
68
|
})
|
|
69
|
+
|
|
39
70
|
// 是否开启分页功能 ====== start======
|
|
40
71
|
const pageable = computed(() => {
|
|
41
|
-
return isFrontPage.value || props.config?.pageable == '1'
|
|
72
|
+
return (isFrontPage.value || props.config?.pageable == '1') && !isVirtualized.value
|
|
42
73
|
})
|
|
74
|
+
|
|
43
75
|
// 分页器布局模式
|
|
44
76
|
const pageAlign = computed(() => {
|
|
45
77
|
return props.config?.pageAlign
|
|
@@ -252,6 +284,7 @@ export default {
|
|
|
252
284
|
retObj.className = `${retObj.className || ''} clear-index`
|
|
253
285
|
}
|
|
254
286
|
if (!isVirtualized.value) {
|
|
287
|
+
retObj.className = `${retObj.className} cell-col-ellipsis`
|
|
255
288
|
if (!retObj.prop) {
|
|
256
289
|
retObj.prop = config.metaCode
|
|
257
290
|
}
|
|
@@ -517,6 +550,7 @@ export default {
|
|
|
517
550
|
})
|
|
518
551
|
// 页面大小变动
|
|
519
552
|
watch(() => page.pageSize, async (val) => {
|
|
553
|
+
page.pageSize = val
|
|
520
554
|
const fn = props.config?.sizeChange
|
|
521
555
|
const ret = await fn?.(val, props, page)
|
|
522
556
|
if (ret && isArray(ret)) {
|
|
@@ -600,7 +634,6 @@ export default {
|
|
|
600
634
|
const dataList = computed(() => {
|
|
601
635
|
return totalRow.value?.length ? [...tableData.value, ...totalRow.value] : tableData.value
|
|
602
636
|
})
|
|
603
|
-
// console.log('dynamicMapComp===:', inject('dynamicMapComp'))
|
|
604
637
|
|
|
605
638
|
function cellMouseEnenter(e) {
|
|
606
639
|
const {overflow, content} = eleIsOverflow(e)
|
|
@@ -676,7 +709,7 @@ export default {
|
|
|
676
709
|
}
|
|
677
710
|
if (isVirtualized.value) {
|
|
678
711
|
retVnode = (
|
|
679
|
-
<div className="table-v2-cell" onMouseenter={(e) => cellMouseEnenter(e)}
|
|
712
|
+
<div className="table-v2-cell" onMouseenter={(e) => cellMouseEnenter(e)} onMouseleave={(e) => cellMouseout(e)}>
|
|
680
713
|
{retVnode}
|
|
681
714
|
</div>
|
|
682
715
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as default} from './src/index.vue'
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, inject, useAttrs } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
name: 'SimpleFormItemPc'
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const attrs = useAttrs()
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
label: String,
|
|
13
|
+
labelWidth: [String, Number],
|
|
14
|
+
labelPosition: String,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const formContextKey = inject('_formContextKey')
|
|
18
|
+
const formContext = inject(formContextKey, undefined)
|
|
19
|
+
|
|
20
|
+
const labelStyle = computed(() => {
|
|
21
|
+
if (formContext?.labelPosition === 'top' || props?.labelPosition === 'top') {
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const labelWidth = props.labelWidth || formContext?.labelWidth || ''
|
|
26
|
+
if (labelWidth) return { width: `${parseInt(labelWidth)}px` }
|
|
27
|
+
return {}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const formItemClass = computed(() => {
|
|
31
|
+
const clas = attrs.class
|
|
32
|
+
return [
|
|
33
|
+
clas || '',
|
|
34
|
+
{
|
|
35
|
+
[`label-position__${props.labelPosition || 'right'}`]: true
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<div class="simple-form-item el-form-item" :class="formItemClass" :style="attrs.style">
|
|
43
|
+
<label class="simple-form-item-label el-form-item__label" :style="labelStyle">
|
|
44
|
+
<slot name="label"></slot>
|
|
45
|
+
</label>
|
|
46
|
+
<div class="simple-form-item-content el-form-item__content">
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style lang="scss">
|
|
53
|
+
.simple-form-item {
|
|
54
|
+
display: flex;
|
|
55
|
+
margin-bottom: var(--prmary-marign);
|
|
56
|
+
margin-right: var(--prmary-marign);
|
|
57
|
+
.simple-form-item-label {
|
|
58
|
+
flex: 0 0 auto;
|
|
59
|
+
display: flex;
|
|
60
|
+
font-size: var(--el-form-label-font-size);
|
|
61
|
+
color: var(--el-text-color-regular);
|
|
62
|
+
height: 32px;
|
|
63
|
+
line-height: 32px;
|
|
64
|
+
padding: 0 12px 0 0;
|
|
65
|
+
align-items: center;
|
|
66
|
+
box-sizing: content-box;
|
|
67
|
+
max-width: 100%;
|
|
68
|
+
}
|
|
69
|
+
.simple-form-item-content {
|
|
70
|
+
align-items: center;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex: 1;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
line-height: 32px;
|
|
75
|
+
min-width: 0;
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.label-position__left {
|
|
80
|
+
.simple-form-item-label {
|
|
81
|
+
justify-content: flex-start;
|
|
82
|
+
text-align: left;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
.label-position__right {
|
|
86
|
+
.simple-form-item-label {
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
text-align: right;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
.label-position__top {
|
|
92
|
+
display: block;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
package/src/resolver-web.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import getNativeComps from './components/patchComponents-web'
|
|
3
|
-
import { ElMessage, ElMessageBox } from "element-plus"
|
|
3
|
+
import { ElMessage, ElMessageBox, formContextKey } from "element-plus"
|
|
4
4
|
import { loadingInstance } from './components/loading'
|
|
5
|
-
import { computed, ref, useAttrs } from 'vue';
|
|
5
|
+
import { computed, provide, ref, useAttrs } from 'vue';
|
|
6
6
|
import Resolver from './resolver-common.vue'
|
|
7
7
|
import { generateOpenChildDialog } from './components/childDialog';
|
|
8
8
|
import { generateUniqueId } from './utils/common.js';
|
|
@@ -46,6 +46,9 @@ defineOptions({
|
|
|
46
46
|
const attrs = useAttrs()
|
|
47
47
|
|
|
48
48
|
const resolverRef = ref(null)
|
|
49
|
+
|
|
50
|
+
provide('_formContextKey', formContextKey)
|
|
51
|
+
|
|
49
52
|
defineExpose({
|
|
50
53
|
dynamicMapComp: computed({
|
|
51
54
|
get() {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
.label-position-right {
|
|
64
|
-
.el-form-item__label {
|
|
64
|
+
.el-form-item__label, .simple-form-item-label {
|
|
65
65
|
justify-content: flex-end;
|
|
66
66
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
.label-position-left {
|
|
70
|
-
.el-form-item__label {
|
|
70
|
+
.el-form-item__label, .simple-form-item-label {
|
|
71
71
|
justify-content: flex-start;
|
|
72
72
|
.custom-label-content {
|
|
73
73
|
text-align: left;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
.label-position-top {
|
|
78
78
|
display: block;
|
|
79
|
-
.el-form-item__label {
|
|
79
|
+
.el-form-item__label, .simple-form-item-label {
|
|
80
80
|
display: block;
|
|
81
81
|
width: 100% !important;
|
|
82
82
|
}
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
.el-table .el-table__cell {
|
|
85
85
|
padding: 4px 0;
|
|
86
86
|
}
|
|
87
|
-
.el-form-item {
|
|
87
|
+
.el-form-item, .simple-form-item {
|
|
88
88
|
margin-right: 0;
|
|
89
89
|
margin-bottom: 0;
|
|
90
90
|
}
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
.el-input {
|
|
117
117
|
--el-input-height: 24px;
|
|
118
118
|
}
|
|
119
|
-
.el-form-item__label {
|
|
119
|
+
.el-form-item__label, .simple-form-item-label {
|
|
120
120
|
height: 24px;
|
|
121
121
|
}
|
|
122
|
-
.el-form-item__content {
|
|
122
|
+
.el-form-item__content, .simple-form-item-content {
|
|
123
123
|
min-height: 24px;
|
|
124
124
|
}
|
|
125
125
|
.el-select__wrapper, .el-input__wrapper {
|
|
@@ -154,6 +154,14 @@
|
|
|
154
154
|
.pagination-wrap {
|
|
155
155
|
display: flex;
|
|
156
156
|
}
|
|
157
|
+
.cell-col-ellipsis {
|
|
158
|
+
& > .cell > .el-col {
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
text-overflow: ellipsis;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
157
165
|
// table-v2
|
|
158
166
|
.table-border {
|
|
159
167
|
--el-table-header-bg-color: #f5f6f7;
|
|
@@ -181,6 +189,11 @@
|
|
|
181
189
|
.table-v2-cell {
|
|
182
190
|
padding: 0 16px;
|
|
183
191
|
width: 100%;
|
|
192
|
+
& > .el-col {
|
|
193
|
+
overflow: hidden;
|
|
194
|
+
text-overflow: ellipsis;
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
}
|
|
184
197
|
}
|
|
185
198
|
.table-v2-common-row {
|
|
186
199
|
border-bottom: none;
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
font-weight: inherit;
|
|
5
5
|
}
|
|
6
6
|
.custom-form-item.hidden-label {
|
|
7
|
-
& >
|
|
8
|
-
|
|
7
|
+
& > {
|
|
8
|
+
.el-form-item__label, .simple-form-item-label {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
9
11
|
}
|
|
10
12
|
& > .el-form-item__label-wrap {
|
|
11
13
|
display: none;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
.content-right {
|
|
15
|
-
.el-form-item__content {
|
|
17
|
+
.el-form-item__content, .simple-form-item-content {
|
|
16
18
|
text-align: right;
|
|
17
19
|
justify-content: flex-end;
|
|
18
20
|
}
|
package/src/utils/render.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getCodeMapRules } from '../rules/rulesDriver.js'
|
|
2
|
+
import SimpleFormItemPc from '../components/simpleFormItemPc'
|
|
2
3
|
import { resolveAssetComponents, findComponent, compareComponet, normalPixel, isPlainObject, hasOwn, isFnStr, normalCapitalizeComponent, capitalize, camelize, formatDate, definePrivatelyProp} from './common.js'
|
|
3
4
|
import { resolveComponent, inject } from 'vue'
|
|
4
5
|
import CustomComponentColH5 from '../components/packages-H5/CustomComponentColH5.vue'
|
|
@@ -665,7 +666,7 @@ function generateFormItemPc (config, lang, compProps, params,) {
|
|
|
665
666
|
let props = {}
|
|
666
667
|
let propsKeys
|
|
667
668
|
let slotName = 'default'
|
|
668
|
-
|
|
669
|
+
let formItemComp = resolveComponent('el-form-item')
|
|
669
670
|
if (formItemComp) {
|
|
670
671
|
isFormItem = true
|
|
671
672
|
propsKeys = getComponentPropsKeys(formItemComp)
|
|
@@ -721,6 +722,15 @@ function generateFormItemPc (config, lang, compProps, params,) {
|
|
|
721
722
|
return node
|
|
722
723
|
}
|
|
723
724
|
}
|
|
725
|
+
|
|
726
|
+
// 表格中的列,不需要form-item的时候,就尽可能不要,可以提升性能
|
|
727
|
+
if (!props?.rules?.length && props?.class?.['hidden-label'] && config.isColumn) {
|
|
728
|
+
return node
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (!props?.rules?.length) {
|
|
732
|
+
formItemComp = SimpleFormItemPc
|
|
733
|
+
}
|
|
724
734
|
|
|
725
735
|
const slots = {
|
|
726
736
|
error: (info) => createFormLabelErrorTip(info, config, lang)
|
|
@@ -729,6 +739,7 @@ function generateFormItemPc (config, lang, compProps, params,) {
|
|
|
729
739
|
if (isFormItem && slotName !== 'label') {
|
|
730
740
|
slots.label = () => createFormLable(config, lang)
|
|
731
741
|
}
|
|
742
|
+
|
|
732
743
|
return (
|
|
733
744
|
<formItemComp ref={(e) => {definePrivatelyProp(config, 'formItemVm', e)}} key={config.requiredFlag} class="custom-form-item" {...props}>{slots}</formItemComp>
|
|
734
745
|
)
|
|
@@ -787,6 +798,10 @@ export function generateFormItemPolyfill(config, lang, compProps, _isH5, params)
|
|
|
787
798
|
}
|
|
788
799
|
}
|
|
789
800
|
|
|
801
|
+
function isHiddenLable(config) {
|
|
802
|
+
return (config.labelWidth == 0 || config.labelWidth === '0px' || config.labelHidden == '1') && config.showLabel != '1'
|
|
803
|
+
}
|
|
804
|
+
|
|
790
805
|
function getFormItemExtendProps(config, lang, params, compProps) {
|
|
791
806
|
const prop = config.dynamicHireRelat || ''
|
|
792
807
|
// const propAttr = config.dynamicHireRelat ? config.dynamicHireRelat?.split('->') : []
|
|
@@ -803,7 +818,7 @@ function getFormItemExtendProps(config, lang, params, compProps) {
|
|
|
803
818
|
class: {
|
|
804
819
|
[`vertical-${config['label-vertical'] || config['labelVertical'] || 'center'}`]: true,
|
|
805
820
|
'content-right': config.contentRight,
|
|
806
|
-
'hidden-label': (config
|
|
821
|
+
'hidden-label': isHiddenLable(config),
|
|
807
822
|
[`label-position-${config['label-position'] || config['labelPosition'] || 'right'}`]: true // label-position 支持三个值,right、left、top
|
|
808
823
|
},
|
|
809
824
|
style,
|
|
@@ -818,39 +833,43 @@ export function getFormItemRule(config, lang, params, compProps, fromCustValid)
|
|
|
818
833
|
if (config.showMoney && config.metaType == 'ElInput') {
|
|
819
834
|
trigger = 'blur'
|
|
820
835
|
}
|
|
821
|
-
const rules = [
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
val =
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
// isMatch在下来框的时候,表示当前值没有在下拉选项中匹配到,就表示没有选中值;因为后端在表字段为数字类型的时候,默认返回的是0值
|
|
842
|
-
if (hasOwn(config, 'isMatch') && !config.isMatch) {
|
|
836
|
+
const rules = []
|
|
837
|
+
// 是否需要去进行校验
|
|
838
|
+
const needToValid = !(
|
|
839
|
+
(compProps?.disabled || isPlainColumn(config, compProps?.disabled)) && config.alongValidate != '1' ||
|
|
840
|
+
isChainHidden({ config })
|
|
841
|
+
)
|
|
842
|
+
if (!needToValid) {
|
|
843
|
+
return rules
|
|
844
|
+
}
|
|
845
|
+
if (!onlyRequiredFlag && required) {
|
|
846
|
+
rules.push({
|
|
847
|
+
// required,
|
|
848
|
+
validator: (rule, value, callback) => {
|
|
849
|
+
let val = config?.refValue
|
|
850
|
+
if (fromCustValid) {
|
|
851
|
+
val = value
|
|
852
|
+
}
|
|
853
|
+
const message = lang.indexOf('zh') > -1 ? `${config.metaNameZh || ''}不能为空` : `${config.metaNameEn || ''} can not be empty`
|
|
854
|
+
if (!onlyRequiredFlag && required) {
|
|
855
|
+
if (val === '' || val === null || val === undefined || (Array.isArray(val) && !val.length)) {
|
|
843
856
|
callback(new Error(message))
|
|
844
857
|
} else {
|
|
845
|
-
|
|
858
|
+
// isMatch在下来框的时候,表示当前值没有在下拉选项中匹配到,就表示没有选中值;因为后端在表字段为数字类型的时候,默认返回的是0值
|
|
859
|
+
if (hasOwn(config, 'isMatch') && !config.isMatch) {
|
|
860
|
+
callback(new Error(message))
|
|
861
|
+
} else {
|
|
862
|
+
callback()
|
|
863
|
+
}
|
|
846
864
|
}
|
|
865
|
+
} else {
|
|
866
|
+
callback()
|
|
847
867
|
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}]
|
|
868
|
+
},
|
|
869
|
+
trigger,
|
|
870
|
+
})
|
|
871
|
+
}
|
|
872
|
+
|
|
854
873
|
let regexPattern = []
|
|
855
874
|
if (config.regexPattern) {
|
|
856
875
|
try {
|
|
@@ -874,14 +893,6 @@ export function getFormItemRule(config, lang, params, compProps, fromCustValid)
|
|
|
874
893
|
if (regexPattern?.length) {
|
|
875
894
|
rules.push({
|
|
876
895
|
validator: (rule, value, callback) => {
|
|
877
|
-
if ((compProps?.disabled || isPlainColumn(config, compProps?.disabled)) && config.alongValidate != '1') {
|
|
878
|
-
callback()
|
|
879
|
-
return
|
|
880
|
-
}
|
|
881
|
-
if (isChainHidden({ config })) {
|
|
882
|
-
callback()
|
|
883
|
-
return
|
|
884
|
-
}
|
|
885
896
|
const bingdValue = config?.refValue
|
|
886
897
|
if (fromCustValid) {
|
|
887
898
|
val = value
|
|
@@ -909,26 +920,20 @@ export function getFormItemRule(config, lang, params, compProps, fromCustValid)
|
|
|
909
920
|
})
|
|
910
921
|
}
|
|
911
922
|
let validators = config.validators
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
validators.
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
callback
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
return validator(rule, config.refValue, callback, config)
|
|
927
|
-
},
|
|
928
|
-
trigger,
|
|
929
|
-
})
|
|
930
|
-
}
|
|
931
|
-
})
|
|
923
|
+
if (validators) {
|
|
924
|
+
validators = isArray(validators) ? validators : [validators]
|
|
925
|
+
if (validators && validators.length) {
|
|
926
|
+
validators.forEach(validator => {
|
|
927
|
+
if (isFunction(validator)) {
|
|
928
|
+
rules.push({
|
|
929
|
+
validator: (rule, value, callback) => {
|
|
930
|
+
return validator(rule, config.refValue, callback, config)
|
|
931
|
+
},
|
|
932
|
+
trigger,
|
|
933
|
+
})
|
|
934
|
+
}
|
|
935
|
+
})
|
|
936
|
+
}
|
|
932
937
|
}
|
|
933
938
|
return rules
|
|
934
939
|
}
|
|
@@ -995,7 +1000,7 @@ function createFormLable(config, lang = 'zh') {
|
|
|
995
1000
|
<div title={lang.indexOf('zh') > -1 ? (config.labelZh || config.metaNameZh) : (config.labelEn || config.metaNameEn)} class="custom-label">
|
|
996
1001
|
<span
|
|
997
1002
|
onMouseenter={(e) => labelMouseEnenter(e, config, lang)}
|
|
998
|
-
|
|
1003
|
+
onMouseleave={() => config._labelShowTip = false}
|
|
999
1004
|
class={`custom-label-content ${required ? 'custom-label-require' : ''}`} style={config.labelStyle}
|
|
1000
1005
|
onClick={() => config.onLabelClick && config.onLabelClick?.(config)}
|
|
1001
1006
|
>
|