resolver-egretimp-plus 0.1.112 → 0.1.114
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 +4 -0
- package/dist/theme/element/src/components/form.scss +3 -3
- package/dist/theme/element/src/components/table.scss +3 -3
- package/dist/theme/element/src/components/text.scss +17 -0
- package/dist/theme/element/src/index.scss +5 -3
- package/dist/web/index.js +13 -13
- package/package.json +1 -1
- package/src/analysisComponent.jsx +2 -1
- package/src/components/helper/dock.js +16 -6
- package/src/components/helper/table.jsx +26 -23
- 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 +33 -4
- package/src/components/packages-web/ElText.jsx +0 -1
- 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 +4 -0
- package/src/theme/element/components/form.scss +3 -3
- package/src/theme/element/components/table.scss +3 -3
- package/src/theme/element/components/text.scss +17 -0
- package/src/theme/element/index.scss +5 -3
- package/src/utils/render.jsx +44 -35
- package/src/components/styles/CustomComponenTable.scss +0 -141
- package/src/components/styles/text.scss +0 -20
package/package.json
CHANGED
|
@@ -152,6 +152,8 @@ export default {
|
|
|
152
152
|
})
|
|
153
153
|
ruleExecuter.penddingRules[hireRelat] = null
|
|
154
154
|
}
|
|
155
|
+
// 使用json-rules-engine书写的规则,打开这边,需要对之前的规则进行注释,并且需要再index.js文件中进行开启 ====end====
|
|
156
|
+
|
|
155
157
|
if (props.config?.immediateClickEvent) {
|
|
156
158
|
const unWatch = watch(dataLoad, (val) => {
|
|
157
159
|
if (val) {
|
|
@@ -164,7 +166,6 @@ export default {
|
|
|
164
166
|
immediate: true
|
|
165
167
|
})
|
|
166
168
|
}
|
|
167
|
-
// 使用json-rules-engine书写的规则,打开这边,需要对之前的规则进行注释,并且需要再index.js文件中进行开启 ====end====
|
|
168
169
|
}
|
|
169
170
|
const onVnodeUnmounted = () => {
|
|
170
171
|
props.config.vmIsBind = false
|
|
@@ -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 () => {
|
|
@@ -40,9 +40,10 @@ export async function tableValidate({
|
|
|
40
40
|
const currentStart = (page.pageNum - 1) * page.pageSize
|
|
41
41
|
const currentEnd = page.pageNum * page.pageSize
|
|
42
42
|
for (let index = 0; index < list.length; index++) {
|
|
43
|
+
|
|
43
44
|
if (index < currentStart || index >= currentEnd) {
|
|
44
45
|
const row = list[index];
|
|
45
|
-
const configColumns = multiPmPageMetaList[index] || multiPmPageMetaList[index % page.pageSize]
|
|
46
|
+
const configColumns = multiPmPageMetaList[index] || multiPmPageMetaList[index % page.pageSize] || multiPmPageMetaList[0]
|
|
46
47
|
const rowScope = {row, $index: index}
|
|
47
48
|
for (let j = 0; j < configColumns.length; j++) {
|
|
48
49
|
const columnConfig = configColumns[j];
|
|
@@ -58,31 +59,33 @@ export async function tableValidate({
|
|
|
58
59
|
disabled: calcDisable(columnConfig, props.mode)
|
|
59
60
|
}
|
|
60
61
|
const rules = getFormItemRule(columnConfig, lang, params, compProps, true)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
if (rules && rules.length) {
|
|
63
|
+
const validator = new AsyncValidator({
|
|
64
|
+
[columnConfig.dynamicHireRelat]: rules
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
async function toValidate() {
|
|
68
|
+
try {
|
|
69
|
+
await validator.validate({[columnConfig.dynamicHireRelat]: row[columnConfig.metaCode]})
|
|
70
|
+
} catch (error) {
|
|
71
|
+
return new Promise((resolve, inject) => {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
let failPageNum = 0
|
|
74
|
+
if (index) {
|
|
75
|
+
failPageNum = parseInt((index + 1) / page.pageSize)
|
|
76
|
+
if ((index + 1) % page.pageSize) {
|
|
77
|
+
failPageNum ++
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
81
|
-
}
|
|
80
|
+
page.pageNum = failPageNum
|
|
81
|
+
inject({})
|
|
82
|
+
});
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
return true
|
|
82
86
|
}
|
|
83
|
-
|
|
87
|
+
await toValidate()
|
|
84
88
|
}
|
|
85
|
-
await toValidate()
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -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
|
}
|
|
@@ -28,22 +28,50 @@ export default {
|
|
|
28
28
|
// if (props.config?.pageSize) {
|
|
29
29
|
// pageSize = parseInt(props.config.pageSize) || 5
|
|
30
30
|
// }
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|
|
33
53
|
})
|
|
34
54
|
const page = reactive({
|
|
35
55
|
pageNum: 1,
|
|
36
56
|
pageSize,
|
|
37
57
|
total: 0,
|
|
38
58
|
})
|
|
59
|
+
|
|
60
|
+
// 在数据量超过10的话,默认开启分页功能
|
|
61
|
+
const defaultPageable = computed(() => {
|
|
62
|
+
return !(props.config?.frontPageFlag == '1' || props.config?.pageable == '1') && modelValue.value?.length > 10
|
|
63
|
+
})
|
|
64
|
+
|
|
39
65
|
// 开启前端分页
|
|
40
66
|
const isFrontPage = computed(() => {
|
|
41
|
-
return props.config?.frontPageFlag == '1'
|
|
67
|
+
return (props.config?.frontPageFlag == '1' || defaultPageable.value) && !isVirtualized.value
|
|
42
68
|
})
|
|
69
|
+
|
|
43
70
|
// 是否开启分页功能 ====== start======
|
|
44
71
|
const pageable = computed(() => {
|
|
45
|
-
return isFrontPage.value || props.config?.pageable == '1'
|
|
72
|
+
return (isFrontPage.value || props.config?.pageable == '1') && !isVirtualized.value
|
|
46
73
|
})
|
|
74
|
+
|
|
47
75
|
// 分页器布局模式
|
|
48
76
|
const pageAlign = computed(() => {
|
|
49
77
|
return props.config?.pageAlign
|
|
@@ -522,6 +550,7 @@ export default {
|
|
|
522
550
|
})
|
|
523
551
|
// 页面大小变动
|
|
524
552
|
watch(() => page.pageSize, async (val) => {
|
|
553
|
+
page.pageSize = val
|
|
525
554
|
const fn = props.config?.sizeChange
|
|
526
555
|
const ret = await fn?.(val, props, page)
|
|
527
556
|
if (ret && isArray(ret)) {
|
|
@@ -2,7 +2,6 @@ import { ElText, ElIcon } from 'element-plus'
|
|
|
2
2
|
import { computed, defineProps, inject, getCurrentInstance, useAttrs, useSlots } from 'vue'
|
|
3
3
|
import { commonPropsType } from '../../utils/index.js'
|
|
4
4
|
import { h, resolveComponent, withModifiers } from 'vue'
|
|
5
|
-
import '../styles/text.scss'
|
|
6
5
|
import { useToolTip } from '../helper/calcTooltip.jsx'
|
|
7
6
|
|
|
8
7
|
export default {
|
|
@@ -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 {
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
.el-text {
|
|
2
2
|
line-height: 1em;
|
|
3
|
+
}
|
|
4
|
+
.resolver-custom-cust-input-wrap {
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
min-height: 32px;
|
|
10
|
+
line-height: 24px;
|
|
11
|
+
padding: 1px 11px;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
|
|
14
|
+
box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
|
|
15
|
+
background: var(--el-input-bg-color, var(--el-fill-color-blank));
|
|
16
|
+
cursor: 'not-allowed';
|
|
17
|
+
}
|
|
18
|
+
.resolver-custom-is-disabled {
|
|
19
|
+
background: var(--el-disabled-bg-color);
|
|
3
20
|
}
|
|
@@ -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)
|
|
@@ -723,10 +724,13 @@ function generateFormItemPc (config, lang, compProps, params,) {
|
|
|
723
724
|
}
|
|
724
725
|
|
|
725
726
|
// 表格中的列,不需要form-item的时候,就尽可能不要,可以提升性能
|
|
726
|
-
|
|
727
727
|
if (!props?.rules?.length && props?.class?.['hidden-label'] && config.isColumn) {
|
|
728
728
|
return node
|
|
729
729
|
}
|
|
730
|
+
|
|
731
|
+
if (!props?.rules?.length) {
|
|
732
|
+
formItemComp = SimpleFormItemPc
|
|
733
|
+
}
|
|
730
734
|
|
|
731
735
|
const slots = {
|
|
732
736
|
error: (info) => createFormLabelErrorTip(info, config, lang)
|
|
@@ -735,6 +739,7 @@ function generateFormItemPc (config, lang, compProps, params,) {
|
|
|
735
739
|
if (isFormItem && slotName !== 'label') {
|
|
736
740
|
slots.label = () => createFormLable(config, lang)
|
|
737
741
|
}
|
|
742
|
+
|
|
738
743
|
return (
|
|
739
744
|
<formItemComp ref={(e) => {definePrivatelyProp(config, 'formItemVm', e)}} key={config.requiredFlag} class="custom-form-item" {...props}>{slots}</formItemComp>
|
|
740
745
|
)
|
|
@@ -837,31 +842,33 @@ export function getFormItemRule(config, lang, params, compProps, fromCustValid)
|
|
|
837
842
|
if (!needToValid) {
|
|
838
843
|
return rules
|
|
839
844
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
if (
|
|
850
|
-
|
|
851
|
-
} else {
|
|
852
|
-
// isMatch在下来框的时候,表示当前值没有在下拉选项中匹配到,就表示没有选中值;因为后端在表字段为数字类型的时候,默认返回的是0值
|
|
853
|
-
if (hasOwn(config, 'isMatch') && !config.isMatch) {
|
|
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)) {
|
|
854
856
|
callback(new Error(message))
|
|
855
857
|
} else {
|
|
856
|
-
|
|
858
|
+
// isMatch在下来框的时候,表示当前值没有在下拉选项中匹配到,就表示没有选中值;因为后端在表字段为数字类型的时候,默认返回的是0值
|
|
859
|
+
if (hasOwn(config, 'isMatch') && !config.isMatch) {
|
|
860
|
+
callback(new Error(message))
|
|
861
|
+
} else {
|
|
862
|
+
callback()
|
|
863
|
+
}
|
|
857
864
|
}
|
|
865
|
+
} else {
|
|
866
|
+
callback()
|
|
858
867
|
}
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
trigger,
|
|
864
|
-
})
|
|
868
|
+
},
|
|
869
|
+
trigger,
|
|
870
|
+
})
|
|
871
|
+
}
|
|
865
872
|
|
|
866
873
|
let regexPattern = []
|
|
867
874
|
if (config.regexPattern) {
|
|
@@ -913,18 +920,20 @@ export function getFormItemRule(config, lang, params, compProps, fromCustValid)
|
|
|
913
920
|
})
|
|
914
921
|
}
|
|
915
922
|
let validators = config.validators
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
validators.
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
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
|
+
}
|
|
928
937
|
}
|
|
929
938
|
return rules
|
|
930
939
|
}
|