Commit 6b92e68a by Jaxon

feat(营销推送策略): 新增变量文本域字数限制并优化条件选择逻辑

- 为变量文本域组件添加字数统计和最大长度限制,默认最大长度为1000
- 调整文本域外层样式以正确展示字数统计标签
- 无可用子变量时禁用变量单选按钮并添加提示文案
- 修复变量选择默认值来源逻辑与枚举值名称同步问题
1 parent b7dec71d
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
:prop="`${propPrefix}.valueSource`"> :prop="`${propPrefix}.valueSource`">
<el-radio-group :value="item.valueSource" <el-radio-group :value="item.valueSource"
@input="handleValueSource"> @input="handleValueSource">
<el-radio-button :label="enums.conditionVariableSourceTypeEnum.VARIABLE"> <el-radio-button :disabled="getVariableRefCodeOptions.length === 0"
:label="enums.conditionVariableSourceTypeEnum.VARIABLE"
:title="getVariableRefCodeOptions.length === 0 ? '所选变量没有支持的子变量' : ''">
变量 变量
</el-radio-button> </el-radio-button>
<el-radio-button :label="enums.conditionVariableSourceTypeEnum.VALUE"> <el-radio-button :label="enums.conditionVariableSourceTypeEnum.VALUE">
...@@ -230,8 +232,7 @@ export default { ...@@ -230,8 +232,7 @@ export default {
// 只要切换一个, 子级全清 // 只要切换一个, 子级全清
// valueType // valueType
const variable = this.options.conditionVariables.find(item => item.variableCode === val); const variable = this.options.conditionVariables.find(item => item.variableCode === val);
this.$emit("input", { const value = {
...this.item,
variableCode: val, variableCode: val,
valueType: variable?.variableType, valueType: variable?.variableType,
operator: undefined, operator: undefined,
...@@ -241,6 +242,13 @@ export default { ...@@ -241,6 +242,13 @@ export default {
numberValue: undefined, numberValue: undefined,
enumValue: undefined, enumValue: undefined,
dateValue: undefined, dateValue: undefined,
};
if (!variable?.sopConditionVariableDTOList || variable?.sopConditionVariableDTOList?.length <= 0) {
value.valueSource = ConditionVariableSourceTypeEnum.VALUE;
}
this.$emit("input", {
...this.item,
...value,
}); });
}, },
handleOperatorChange(val) { handleOperatorChange(val) {
...@@ -273,7 +281,8 @@ export default { ...@@ -273,7 +281,8 @@ export default {
this.updateItem("dateValue", val); this.updateItem("dateValue", val);
}, },
handleEnumChange(val) { handleEnumChange(val) {
this.updateItem("enumValue", val); const enumItem = this.getVariableEnumOptions.find(item => item.enumCode === val);
this.$emit("input", { ...this.item, enumValue: val, enumValueName: enumItem?.enumName || "" });
}, },
}, },
}; };
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<div style="margin-top:8px"> <div style="margin-top:8px">
<div v-if="item.messageType === MessageTypeEnum.VARIABLE_TEXT" class="type-item"> <div v-if="item.messageType === MessageTypeEnum.VARIABLE_TEXT" class="type-item">
<VariableTextarea style="width:580px" <VariableTextarea style="width:580px"
:max-length="1000"
:value="item.content" :value="item.content"
:variable-list="messageVariables" :variable-list="messageVariables"
@input="handleContentChange" /> @input="handleContentChange" />
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
resize="none" resize="none"
rows="8" rows="8"
type="textarea" type="textarea"
show-word-limit
:maxlength="maxLength"
:value="value" :value="value"
@input="handleInput"> @input="handleInput">
</el-input> </el-input>
...@@ -37,6 +39,10 @@ ...@@ -37,6 +39,10 @@
export default { export default {
name: "VariableTextarea", name: "VariableTextarea",
props: { props: {
maxLength: {
type: Number,
default: 1000,
},
value: { value: {
type: String, type: String,
required: true, required: true,
...@@ -93,12 +99,19 @@ export default { ...@@ -93,12 +99,19 @@ export default {
.variable-textarea-wrapper { .variable-textarea-wrapper {
border-radius: 4px; border-radius: 4px;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
::v-deep .el-textarea__inner { ::v-deep .el-textarea {
border: none; .el-textarea__inner {
border-radius: 0; border: none;
box-shadow: none; border-radius: 0;
background-color: #f5f5f5; box-shadow: none;
color: #666; background-color: #f5f5f5;
color: #666;
}
.el-input__count {
right: 10px;
bottom: -42px;
background-color: transparent;
}
} }
.foot-wrapper { .foot-wrapper {
background-color: #f5f6fa; background-color: #f5f6fa;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!