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