Commit d26d1e99 by Jaxon

Merge branch 'feature/marketing-sop-push-strategy' into 'SAAS+V5.8.3'

Feature/marketing sop push strategy

See merge request !764
2 parents 68bf0df9 09dd806f
......@@ -195,7 +195,7 @@ export const routerName = {
parentId: "92210",
cache: false,
sideHidden: true,
activePath: "/marketing-push-strategy/modify",
activePath: "/marketing-push-strategy",
},
component: _import("marketingManagement/marketingPushStrategy/views/modify/index"),
},
......
......@@ -25,7 +25,8 @@
</el-select>
</el-form-item>
<el-form-item label="目标群:"
<el-form-item v-if="item.actionType === 1"
label="目标群:"
:prop="`${propPrefix}.targetGroupType`"
:rules="[{ required: true, message: '请选择目标群', trigger: 'change' }]">
<el-radio-group :value="item.targetGroupType">
......@@ -35,7 +36,8 @@
</el-radio-group>
</el-form-item>
<el-form-item label="消息内容:"
<el-form-item v-if="item.actionType === 1"
label="消息内容:"
style="margin-bottom:0 "
:prop="`${propPrefix}.messageType`"
:rules="[
......
......@@ -3,6 +3,7 @@
<BranchItem v-for="(branch, index) in list"
:key="branch._key"
:branch="branch"
:max-action-length="maxActionLength"
:options="{
messageVariables,
triggers,
......@@ -18,9 +19,15 @@
<el-button class="append-btn"
block
:disabled="list.length >= maxBranchLength"
@click="handleAppendBranch">
<i class="el-icon-plus "></i>
添加分支
<div v-if="list.length < maxBranchLength">
<i class="el-icon-plus "></i>
添加分支
</div>
<div v-else>
已达上限(最多{{ maxBranchLength }}个分支)
</div>
</el-button>
</div>
</template>
......@@ -39,6 +46,14 @@ export default {
event: "input",
},
props: {
maxBranchLength: {
type: Number,
default: 20,
},
maxActionLength: {
type: Number,
default: 10,
},
propPrefix: {
type: String,
default: "",
......@@ -122,6 +137,10 @@ export default {
.append-btn {
width: 100%;
margin-top: 20px;
padding: 0;
line-height: 40px;
font-weight: 500;
font-size: 16px;
}
}
</style>
......@@ -37,8 +37,18 @@
@remove="handleRemoveActions(index)" />
<div class="actions-list-foot-wrapper">
<el-button @click="handleAppendAction">
添加动作
<el-button class="append-btn"
:disabled="branch.actions.length >= maxActionLength"
@click="handleAppendAction">
<div v-if="branch.actions.length < maxActionLength">
<i class="el-icon-plus"> </i>
<span>添加动作</span>
</div>
<div v-else>
<span>
已达上限(最多{{ maxActionLength }}个动作)
</span>
</div>
</el-button>
</div>
</div>
......@@ -58,6 +68,10 @@ export default {
},
inject: ["elForm"],
props: {
maxActionLength: {
type: Number,
default: 10,
},
propPrefix: {
type: String,
default: "",
......@@ -161,6 +175,13 @@ export default {
}
.actions-list-foot-wrapper {
margin-top: 20px;
.append-btn {
padding-top: 0;
padding-bottom: 0;
line-height: 32px;
font-weight: 400;
font-size: 14px;
}
}
}
}
......
......@@ -116,7 +116,7 @@
<el-date-picker placeholder="请选择日期"
style="width:212px"
type="date"
value-format="yyyy-MM-DD"
value-format="yyyy-MM-dd"
:value="item.dateValue"
@input="handleDateChange">
</el-date-picker>
......@@ -223,12 +223,12 @@ export default {
},
handleVariableChange(val) {
// 只要切换一个, 子级全清
// variableType
// valueType
const variable = this.options.conditionVariables.find(item => item.variableCode === val);
this.$emit("input", {
...this.item,
variableCode: val,
variableType: variable?.variableType,
valueType: variable?.variableType,
operator: undefined,
valueSource: 0,
variableRefCode: undefined,
......@@ -243,7 +243,7 @@ export default {
},
handleValueSource(val) {
// 切换, 清子级
// variableType
// valueType
this.$emit("input", {
...this.item,
valueSource: val,
......@@ -264,6 +264,7 @@ export default {
this.updateItem("numberValue", val);
},
handleDateChange(val) {
console.log("val", val);
this.updateItem("dateValue", val);
},
handleEnumChange(val) {
......
......@@ -13,6 +13,7 @@
</div>
</el-divider>
<ConditionItem :conditions="list[index].conditions"
:max-condition-length="maxConditionLength"
:options="options"
:prop-prefix="`list[${index}]`"
:title="`条件组${index + 1}`"
......@@ -25,9 +26,15 @@
<div class="footer-wrapper">
<el-button class="append-button"
icon="el-icon-plus"
:disabled="list.length >= maxGroupLength"
@click="handleAppendConditionGroup">
添加条件组
<div v-if="list.length < maxGroupLength">
<i class="el-icon-plus"></i>
<span>添加条件组</span>
</div>
<div v-else>
<span>已达上限(最多{{ maxGroupLength }}个条件组)</span>
</div>
</el-button>
</div>
</el-form>
......@@ -57,6 +64,14 @@ export default {
type: Object,
default: () => ({}),
},
maxGroupLength: {
type: Number,
default: 10,
},
maxConditionLength: {
type: Number,
default: 50,
},
},
computed: {
formModel() {
......
......@@ -38,10 +38,18 @@
<div class="foot-wrapper">
<el-form-item class="action-form-item" label-width="0">
<el-button class="append-btn"
icon="el-icon-plus"
size="small"
:disabled="conditions.length >= maxConditionLength"
@click="handleAppendCondition">
添加条件
<div v-if="conditions.length < maxConditionLength">
<i class="el-icon-plus"></i>
<span>添加条件</span>
</div>
<div v-else>
<span>
已达上限(最多{{ maxConditionLength }}个条件)
</span>
</div>
</el-button>
</el-form-item>
</div>
......@@ -78,6 +86,10 @@ export default {
type: String,
default: "条件组",
},
maxConditionLength: {
type: Number,
default: 50,
},
},
methods: {
handleUpdateCondition(conditionItem, index) {
......
......@@ -173,6 +173,7 @@ export default {
display: inline-block;
max-width: 400px;
overflow-x: auto;
vertical-align: top;
}
.text-panel {
> .action-wrapper {
......
......@@ -65,18 +65,23 @@ export default {
const list = cloneDeep(this.conditionList);
for (const group of list) {
for (const condition of group.conditions) {
// 获取对应的option
const option = this.conditionVariables.find(item => item.variableCode === condition.variableCode);
console.log("option", option);
const operator = option.operators.find(item => item.code === condition.operator);
if (option) {
condition.variableName = option.variableName;
condition.operatorName = operator.name;
// 处理 变量
if (condition.valueSource === ConditionVariableSourceTypeEnum.VARIABLE) {
const variableOption = option.sopConditionVariableDTOList.find(item => item.variableCode === condition.variableRefCode);
condition.valueLabel = variableOption?.variableName || "-";
} else if (condition.valueType === ConditionVariableTypeEnum.ENUM) {
// 处理 枚举
const enumOption = option.enumValues.find(item => item.enumCode === condition.enumValue);
condition.valueLabel = enumOption?.enumName || "-";
} else {
condition.valueLabel = condition.numberValue ?? (condition.textValue || condition.dateValue || condition.enumValue);
// 其他值 直接取
condition.valueLabel = condition.numberValue ?? (condition.textValue || condition.dateValue);
}
}
}
......
......@@ -104,6 +104,7 @@
</div>
<div style="padding:20px">
<el-form ref="BranchGroupFormRef"
class="branch-form-wrapper"
label-width="150px"
size="small"
:model="form">
......@@ -150,12 +151,11 @@
<script>
import { cloneDeep, isArray } from "lodash-es";
import { deepClone } from "@/common/util";
import { createStrategy, getMarketingPushStrategyDetailApi, getMetaOptionsApi, updateStrategy } from "@/views/marketingManagement/marketingPushStrategy/api/index.js";
import BranchGroup from "@/views/marketingManagement/marketingPushStrategy/components/branchGroup/index.vue";
import ConditionPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionPanel/index.vue";
import SelectStoreDialog from "@/views/marketingManagement/marketingPushStrategy/components/selectStoreDialog/index.vue";
import { hourOptions, MessageTypeEnum, minuteOptions, relativeDateTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { getDefaultBranch, hourOptions, MessageTypeEnum, minuteOptions, relativeDateTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { getFormSchema, getSpecFormSchema, rules } from "@/views/marketingManagement/marketingPushStrategy/views/modify/modify.data.js";
export default {
......@@ -185,7 +185,9 @@ export default {
triggerHour: "10",
triggerMinute: "00",
step2ConditionGroups: [],
branches: [],
branches: [
getDefaultBranch(),
],
},
options: {
conditionVariables: [],
......@@ -313,7 +315,7 @@ export default {
},
dealParams() {
const params = deepClone(this.form);
const params = cloneDeep(this.form);
if (this.$route.query.editType === "edit") {
params.strategyId = this.$route.query.strategyId;
}
......@@ -347,7 +349,6 @@ export default {
return;
}
const params = this.dealParams();
console.log(params);
const api = this.$route.query.editType === "edit" ? updateStrategy : createStrategy;
api(params).then((res) => {
this.$message.success("操作成功");
......@@ -370,6 +371,16 @@ export default {
</script>
<style scoped lang="scss">
::v-deep #step2ConditionGroups {
margin-bottom: 0;
}
.branch-form-wrapper {
::v-deep .el-form-item {
.el-form-item__label {
padding-right: 0;
}
}
}
.wrapper {
height: calc(100vh - 120px);
margin: 0 20px 20px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!