|
@@ -59,19 +59,19 @@
|
|
|
<el-select :disabled="layer.disabled" v-model="item.multy"
|
|
<el-select :disabled="layer.disabled" v-model="item.multy"
|
|
|
@change="handleTypeTwo(index,item.configType,item.multy)"
|
|
@change="handleTypeTwo(index,item.configType,item.multy)"
|
|
|
style="width: 140px;margin: 0 10px;" placeholder="请选择" filterable>
|
|
style="width: 140px;margin: 0 10px;" placeholder="请选择" filterable>
|
|
|
- <el-option v-if="item.configType === '1'" label="比较" value="3"></el-option>
|
|
|
|
|
- <el-option v-if="item.configType === '1'" label="不比较" value="4"></el-option>
|
|
|
|
|
- <template v-else>
|
|
|
|
|
- <el-option label="单选" value="1"></el-option>
|
|
|
|
|
- <el-option label="多选" value="2"></el-option>
|
|
|
|
|
|
|
+ <template v-if="item.configType === '2' || item.configType === '3'">
|
|
|
|
|
+ <el-option v-for="option in getOptions('multy').slice(0,2)" :key="option.label"
|
|
|
|
|
+ :label="option.label" :value="option.value"></el-option>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <el-option v-else v-for="option in getOptions('multy')" :key="option.label" :label="option.label"
|
|
|
|
|
+ :value="option.value"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 输入框 -->
|
|
<!-- 输入框 -->
|
|
|
<template v-if="item.configType === '1'">
|
|
<template v-if="item.configType === '1'">
|
|
|
<!-- 比较 -->
|
|
<!-- 比较 -->
|
|
|
- <el-input v-if="item.multy === '3'" style="width: 240px;" v-model="item.configVal"
|
|
|
|
|
|
|
+ <el-input v-if="item.multy === 1" style="width: 240px;" v-model="item.configVal"
|
|
|
placeholder="如: 100-500" :class="{ 'is-error': item.error_configVal }"
|
|
placeholder="如: 100-500" :class="{ 'is-error': item.error_configVal }"
|
|
|
@input="clearFieldError(index, 'configVal')">
|
|
@input="clearFieldError(index, 'configVal')">
|
|
|
<template #prepend>
|
|
<template #prepend>
|
|
@@ -91,7 +91,7 @@
|
|
|
|
|
|
|
|
<!-- 选择框 -->
|
|
<!-- 选择框 -->
|
|
|
<template v-else-if="item.configType === '2'">
|
|
<template v-else-if="item.configType === '2'">
|
|
|
- <el-select :multiple="item.multy === '2'" v-model="item.configVal" placeholder="请选择"
|
|
|
|
|
|
|
+ <el-select :multiple="item.multy === 1" v-model="item.configVal" placeholder="请选择"
|
|
|
style="width: 240px" :class="{ 'is-error': item.error_configVal }"
|
|
style="width: 240px" :class="{ 'is-error': item.error_configVal }"
|
|
|
@input="clearFieldError(index, 'configVal')">
|
|
@input="clearFieldError(index, 'configVal')">
|
|
|
<el-option v-for="option in getOptions(camelToSnake(item.fieldName))"
|
|
<el-option v-for="option in getOptions(camelToSnake(item.fieldName))"
|
|
@@ -102,7 +102,7 @@
|
|
|
<!-- 日期 -->
|
|
<!-- 日期 -->
|
|
|
<template v-else-if="item.configType === '3'">
|
|
<template v-else-if="item.configType === '3'">
|
|
|
<div style="width: 240px !important;">
|
|
<div style="width: 240px !important;">
|
|
|
- <el-date-picker v-if="item.multy === '1'" v-model="item.configVal" type="date"
|
|
|
|
|
|
|
+ <el-date-picker v-if="item.multy === 2" v-model="item.configVal" type="date"
|
|
|
placeholder="请选择" :class="{ 'is-error': item.error_configVal }"
|
|
placeholder="请选择" :class="{ 'is-error': item.error_configVal }"
|
|
|
@input="clearFieldError(index, 'configVal')" />
|
|
@input="clearFieldError(index, 'configVal')" />
|
|
|
|
|
|
|
@@ -248,7 +248,7 @@
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!item.multy && item.multy !== '0') {
|
|
|
|
|
|
|
+ if (!item.multy && item.multy !== 0) {
|
|
|
markFieldError(i, 'multy');
|
|
markFieldError(i, 'multy');
|
|
|
scrollToError(i);
|
|
scrollToError(i);
|
|
|
ElMessage.error(`第 ${i + 1} 条配置的「配置方式」不能为空`);
|
|
ElMessage.error(`第 ${i + 1} 条配置的「配置方式」不能为空`);
|
|
@@ -336,15 +336,15 @@
|
|
|
const handleTypeOne = (index, configType) => {
|
|
const handleTypeOne = (index, configType) => {
|
|
|
console.log('选择1变化:', 'index', index, 'configType', configType)
|
|
console.log('选择1变化:', 'index', index, 'configType', configType)
|
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
|
- // multy:1-单选 2-多选 3-比较 4-不比较
|
|
|
|
|
|
|
+ // multy:1-多选 2-单选 3-大于> 4-小于<
|
|
|
|
|
|
|
|
configFormList.value.configList[index][`error_configType`] = false;
|
|
configFormList.value.configList[index][`error_configType`] = false;
|
|
|
|
|
|
|
|
if (configType === '1') {
|
|
if (configType === '1') {
|
|
|
- configFormList.value.configList[index].multy = '4'
|
|
|
|
|
|
|
+ configFormList.value.configList[index].multy = 2
|
|
|
configFormList.value.configList[index].configVal = ''
|
|
configFormList.value.configList[index].configVal = ''
|
|
|
} else if (configType === '2' || configType === '3') {
|
|
} else if (configType === '2' || configType === '3') {
|
|
|
- configFormList.value.configList[index].multy = '1'
|
|
|
|
|
|
|
+ configFormList.value.configList[index].multy = 2
|
|
|
configFormList.value.configList[index].configVal = ''
|
|
configFormList.value.configList[index].configVal = ''
|
|
|
}
|
|
}
|
|
|
console.log('1-handleTypeOne-configVal', configFormList.value.configList[index].configVal)
|
|
console.log('1-handleTypeOne-configVal', configFormList.value.configList[index].configVal)
|
|
@@ -354,9 +354,9 @@
|
|
|
const handleTypeTwo = (index, configType, multy) => {
|
|
const handleTypeTwo = (index, configType, multy) => {
|
|
|
console.log('选择2变化:', 'index', index, 'configType', configType, 'multy', multy)
|
|
console.log('选择2变化:', 'index', index, 'configType', configType, 'multy', multy)
|
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
|
- // multy:1-单选 2-多选 3-比较 4-不比较
|
|
|
|
|
|
|
+ // multy:1-多选 2-单选 3-大于> 4-小于<
|
|
|
|
|
|
|
|
- if (configType === '3' && multy === '2' || configType === '2' && multy === '2') {
|
|
|
|
|
|
|
+ if (configType === '3' && multy === 1 || configType === '2' && multy === 1) {
|
|
|
configFormList.value.configList[index].configVal = []
|
|
configFormList.value.configList[index].configVal = []
|
|
|
} else {
|
|
} else {
|
|
|
configFormList.value.configList[index].configVal = ''
|
|
configFormList.value.configList[index].configVal = ''
|
|
@@ -405,10 +405,10 @@
|
|
|
// 选择框
|
|
// 选择框
|
|
|
if (item.configType === '2') {
|
|
if (item.configType === '2') {
|
|
|
const typeCode = camelToSnake(item.fieldName)
|
|
const typeCode = camelToSnake(item.fieldName)
|
|
|
- if (item.multy === '1') {
|
|
|
|
|
|
|
+ if (item.multy === 2) {
|
|
|
// 单选
|
|
// 单选
|
|
|
valueText = getDictionaryName(typeCode, item.configVal)
|
|
valueText = getDictionaryName(typeCode, item.configVal)
|
|
|
- } else if (item.multy === '2') {
|
|
|
|
|
|
|
+ } else if (item.multy === 1) {
|
|
|
// 多选
|
|
// 多选
|
|
|
// valueText = item.configVal.map((v) => getDictionaryName(typeCode, v)).join('、')
|
|
// valueText = item.configVal.map((v) => getDictionaryName(typeCode, v)).join('、')
|
|
|
valueText = Array.isArray(item.configVal)
|
|
valueText = Array.isArray(item.configVal)
|
|
@@ -417,17 +417,14 @@
|
|
|
.split(',')
|
|
.split(',')
|
|
|
.map(v => getDictionaryName(typeCode, v))
|
|
.map(v => getDictionaryName(typeCode, v))
|
|
|
.join('、')
|
|
.join('、')
|
|
|
-
|
|
|
|
|
- console.log('选择框多选', valueText)
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 日期
|
|
// 日期
|
|
|
else if (item.configType === '3') {
|
|
else if (item.configType === '3') {
|
|
|
- if (item.multy === '1') {
|
|
|
|
|
|
|
+ if (item.multy === 2) {
|
|
|
valueText = formatDateToYMD(item.configVal)
|
|
valueText = formatDateToYMD(item.configVal)
|
|
|
- } else if (item.multy === '2') {
|
|
|
|
|
|
|
+ } else if (item.multy === 1) {
|
|
|
if (item.configVal[0] || item.configVal[1]) {
|
|
if (item.configVal[0] || item.configVal[1]) {
|
|
|
valueText = `${formatDateToYMD(item.configVal[0])}到${formatDateToYMD(item.configVal[1])}`
|
|
valueText = `${formatDateToYMD(item.configVal[0])}到${formatDateToYMD(item.configVal[1])}`
|
|
|
} else {
|
|
} else {
|
|
@@ -438,7 +435,7 @@
|
|
|
|
|
|
|
|
// 输入框
|
|
// 输入框
|
|
|
else {
|
|
else {
|
|
|
- if (item.multy === '3') {
|
|
|
|
|
|
|
+ if (item.multy === 1) {
|
|
|
if (item.configVal) {
|
|
if (item.configVal) {
|
|
|
const [min, max] = item.configVal.split('-').map(Number)
|
|
const [min, max] = item.configVal.split('-').map(Number)
|
|
|
valueText = `${min}到${max}`
|
|
valueText = `${min}到${max}`
|
|
@@ -450,8 +447,9 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (fieldDesc && valueText && valueText.length > 0) {
|
|
if (fieldDesc && valueText && valueText.length > 0) {
|
|
|
- item.fieldDesc = `${fieldDesc}为${valueText}`
|
|
|
|
|
- return `${fieldDesc}为${valueText}`
|
|
|
|
|
|
|
+ // getOptions('multy')[item.multy - 1].label
|
|
|
|
|
+ item.fieldDesc = `${fieldDesc}为${getOptions('multy')[item.multy - 1].label}${valueText}`
|
|
|
|
|
+ return `${fieldDesc}为${getOptions('multy')[item.multy - 1].label}${valueText}`
|
|
|
} else {
|
|
} else {
|
|
|
return ''
|
|
return ''
|
|
|
}
|
|
}
|
|
@@ -469,20 +467,20 @@
|
|
|
|
|
|
|
|
res.configList.forEach((item, index) => {
|
|
res.configList.forEach((item, index) => {
|
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
// configType:1-输入框 2-选择框 3-日期
|
|
|
- // multy:1-单选 2-多选 3-比较 4-不比较
|
|
|
|
|
|
|
+ // multy:1-多选 2-单选 3-大于> 4-小于<
|
|
|
|
|
|
|
|
if (item.configType === 2) {
|
|
if (item.configType === 2) {
|
|
|
- if (item.multy === 1) {
|
|
|
|
|
|
|
+ if (item.multy === 2) {
|
|
|
item.configVal = Number(item.configVal)
|
|
item.configVal = Number(item.configVal)
|
|
|
} else {
|
|
} else {
|
|
|
item.configVal = item.configVal.split(',').map(Number)
|
|
item.configVal = item.configVal.split(',').map(Number)
|
|
|
}
|
|
}
|
|
|
- } else if (item.configType === 3 && item.multy === 2) {
|
|
|
|
|
|
|
+ } else if (item.configType === 3 && item.multy === 1) {
|
|
|
item.configVal = item.configVal.split(',');
|
|
item.configVal = item.configVal.split(',');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
configFormList.value.configList[index].configType = String(item.configType)
|
|
configFormList.value.configList[index].configType = String(item.configType)
|
|
|
- configFormList.value.configList[index].multy = String(item.multy)
|
|
|
|
|
|
|
+ configFormList.value.configList[index].multy = item.multy
|
|
|
configFormList.value.configList[index].configVal = item.configVal
|
|
configFormList.value.configList[index].configVal = item.configVal
|
|
|
})
|
|
})
|
|
|
|
|
|