|
@@ -11,9 +11,8 @@
|
|
|
<slot name="cus" :handleValidate="handleValidate">
|
|
|
<template v-if="link === 'input'">
|
|
|
<InputCom
|
|
|
- v-if="link === 'input'"
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -37,7 +36,7 @@
|
|
|
<template v-else-if="link === 'select'">
|
|
|
<SelectCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -49,7 +48,7 @@
|
|
|
<template v-else-if="link === 'date'">
|
|
|
<DateCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -63,7 +62,7 @@
|
|
|
<template v-else-if="link === 'datetime'">
|
|
|
<DateTimeCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -77,7 +76,7 @@
|
|
|
<template v-else-if="link === 'time'">
|
|
|
<TimeCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -88,7 +87,7 @@
|
|
|
<template v-else-if="link === 'cascader'">
|
|
|
<CascaderCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -102,7 +101,7 @@
|
|
|
<template v-else-if="link === 'switch'">
|
|
|
<SwitchCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -113,7 +112,7 @@
|
|
|
<template v-else-if="link === 'radio'">
|
|
|
<RadioCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -124,7 +123,7 @@
|
|
|
<template v-else-if="link === 'checkbox'">
|
|
|
<CheckboxCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -132,32 +131,10 @@
|
|
|
>
|
|
|
</CheckboxCom>
|
|
|
</template>
|
|
|
- <template v-else-if="link === 'portOfRegistry'">
|
|
|
- <PortOfRegistryCom
|
|
|
- v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
- :paramOne="paramOne"
|
|
|
- :paramTwo="paramTwo"
|
|
|
- @emitParam="(pOne, pTwo) => {
|
|
|
- $emit('update:paramOne', pOne), $emit('update:paramTwo', pTwo), handleValidate(pOne, pTwo)
|
|
|
- }"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <template v-else-if="link === 'residentMooringPoint'">
|
|
|
- <ResidentMooringPointCom
|
|
|
- v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
- :paramOne="paramOne"
|
|
|
- :paramTwo="paramTwo"
|
|
|
- @emitParam="(pOne, pTwo) => {
|
|
|
- $emit('update:paramOne', pOne), $emit('update:paramTwo', pTwo), handleValidate(pOne, pTwo)
|
|
|
- }"
|
|
|
- />
|
|
|
- </template>
|
|
|
<template v-else-if="link === 'dept'">
|
|
|
<DeptCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
@@ -168,13 +145,38 @@
|
|
|
<template v-else-if="link === 'upload'">
|
|
|
<UploadCom
|
|
|
v-bind="$attrs"
|
|
|
- :label="label"
|
|
|
+ :label="labelCpt"
|
|
|
:param="param"
|
|
|
@emitParam="val => {
|
|
|
$emit('update:param', val), handleValidate(val)
|
|
|
}"
|
|
|
/>
|
|
|
</template>
|
|
|
+ <template v-else-if="link === 'number'">
|
|
|
+ <NumberCom
|
|
|
+ v-if="link === 'number'"
|
|
|
+ v-bind="$attrs"
|
|
|
+ :label="labelCpt"
|
|
|
+ :param="param"
|
|
|
+ @emitParam="val => {
|
|
|
+ $emit('update:param', val), handleValidate(val)
|
|
|
+ }"
|
|
|
+ @emitEnter="handleEnter"
|
|
|
+ >
|
|
|
+ <template v-if="$slots.prefix" #prefix>
|
|
|
+ <slot name="prefix"/>
|
|
|
+ </template>
|
|
|
+ <template v-if="$slots.suffix" #suffix>
|
|
|
+ <slot name="suffix"/>
|
|
|
+ </template>
|
|
|
+ <template v-if="$slots.prepend" #prepend>
|
|
|
+ <slot name="prepend"/>
|
|
|
+ </template>
|
|
|
+ <template v-if="$slots.append" #append>
|
|
|
+ <slot name="append"/>
|
|
|
+ </template>
|
|
|
+ </NumberCom>
|
|
|
+ </template>
|
|
|
</slot>
|
|
|
<div v-if="unit" class="unit">{{unit}}</div>
|
|
|
</el-form-item>
|
|
@@ -205,10 +207,9 @@ import CascaderCom from './cus-form-link/cascader.vue'
|
|
|
import SwitchCom from './cus-form-link/switch.vue'
|
|
|
import RadioCom from './cus-form-link/radio.vue'
|
|
|
import CheckboxCom from './cus-form-link/checkbox.vue'
|
|
|
-import PortOfRegistryCom from './cus-form-link/portOfRegistry.vue'
|
|
|
-import ResidentMooringPointCom from './cus-form-link/residentMooringPoint.vue'
|
|
|
import DeptCom from './cus-form-link/dept.vue'
|
|
|
import UploadCom from './cus-form-link/upload.vue'
|
|
|
+import NumberCom from './cus-form-link/number.vue'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'CusFormColumn',
|
|
@@ -222,25 +223,22 @@ export default defineComponent({
|
|
|
SwitchCom,
|
|
|
RadioCom,
|
|
|
CheckboxCom,
|
|
|
- PortOfRegistryCom,
|
|
|
- ResidentMooringPointCom,
|
|
|
DeptCom,
|
|
|
UploadCom,
|
|
|
+ NumberCom
|
|
|
},
|
|
|
props: {
|
|
|
span: {type: Number, default: 6},
|
|
|
filterSpan: { default: null },
|
|
|
offset: {type: Number, default: 0},
|
|
|
- param: {
|
|
|
- required: true
|
|
|
- },
|
|
|
+ param: {},
|
|
|
paramOne: {},
|
|
|
paramTwo: {},
|
|
|
label: {type: String, default: ''},
|
|
|
required: {default: false},
|
|
|
labelWidth: {type: String, default: ''},
|
|
|
link: {type: String, default: 'input', validator(val: string) {
|
|
|
- return ['cascader', 'checkbox', 'date', 'datetime', 'input', 'radio', 'select', 'switch', 'portOfRegistry', 'residentMooringPoint', 'dept', 'time', 'upload'].includes(val)
|
|
|
+ return ['cascader', 'checkbox', 'date', 'datetime', 'input', 'radio', 'select', 'switch', 'portOfRegistry', 'residentMooringPoint', 'dept', 'time', 'upload', 'number'].includes(val)
|
|
|
}},
|
|
|
rules: {type: Array, default: () => []},
|
|
|
maxLength: {type: Number, default: null},
|
|
@@ -263,6 +261,9 @@ export default defineComponent({
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
+ const labelCpt = computed(() => {
|
|
|
+ return props.label.replace(/[::]([^::]*)$/, "")
|
|
|
+ })
|
|
|
const rulesCpt = computed(() => {
|
|
|
const r = [...props.rules]
|
|
|
if (isValue(props.minLength)) {
|
|
@@ -282,12 +283,12 @@ export default defineComponent({
|
|
|
if (['portOfRegistry', 'residentMooringPoint'].includes(props.link)) {
|
|
|
r.unshift({
|
|
|
handle: (pOne: any, pTwo: any) => isValue(pOne) && isValue(pTwo),
|
|
|
- message: props.defaultErrorMsg ?? `请${doStr}${props.label}`
|
|
|
+ message: props.defaultErrorMsg ?? `请${doStr}${labelCpt.value}`
|
|
|
})
|
|
|
} else {
|
|
|
r.unshift({
|
|
|
handle: (val: any) => isValue(val),
|
|
|
- message: props.defaultErrorMsg ?? `请${doStr}${props.label}`
|
|
|
+ message: props.defaultErrorMsg ?? `请${doStr}${labelCpt.value}`
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -329,7 +330,8 @@ export default defineComponent({
|
|
|
handleValidate,
|
|
|
handleEnter,
|
|
|
ref_cusFormColumn,
|
|
|
- reset
|
|
|
+ reset,
|
|
|
+ labelCpt
|
|
|
}
|
|
|
},
|
|
|
})
|