Commit 284532ec by 陈婉清

Merge branch 'SAAS+V5.8.3-cwq' into 'SAAS+V5.8.3'

Saas+v5.8.3 cwq

See merge request !784
2 parents 17a1774a e453e0e3
...@@ -128,43 +128,6 @@ async function clickRowAction(row, actionText) { ...@@ -128,43 +128,6 @@ async function clickRowAction(row, actionText) {
}, actionText); }, actionText);
} }
async function fillConditionDrawer(page) {
const drawer = page.locator(".step2-condition-group-drawer:visible").last();
await expect(drawer).toBeVisible();
const container = drawer.locator(".condition-container-wrapper").first();
await selectElementOption(page, container.locator(".el-select").nth(0), null);
await selectElementOption(page, container.locator(".el-select").nth(1), null);
const valueButton = container.locator(".el-radio-group .el-radio-button").nth(1);
if (await valueButton.count()) {
await valueButton.click();
await page.waitForTimeout(300);
}
const enumSelect = container.locator(".el-select").nth(2);
const numberInput = container.locator(".el-input-number input").first();
const dateInput = container.locator(".el-date-editor input").first();
const textInputs = container.locator(".el-input input");
if (await numberInput.isVisible().catch(() => false)) {
await numberInput.fill("1");
} else if (await dateInput.isVisible().catch(() => false)) {
await dateInput.fill("2026-06-25");
await page.keyboard.press("Enter");
} else if (await enumSelect.isVisible().catch(() => false)) {
await selectElementOption(page, enumSelect, null);
} else if (await textInputs.count()) {
const lastInput = textInputs.last();
if (await lastInput.isVisible().catch(() => false)) {
await lastInput.fill("E2E条件值");
}
}
await drawer.getByRole("button", { name: "确认" }).click();
await expect(drawer).toBeHidden({ timeout: 10000 });
}
async function fillMinimalWebpageStrategyForm(page, strategyName) { async function fillMinimalWebpageStrategyForm(page, strategyName) {
const baseBox = page.locator(".box").nth(0); const baseBox = page.locator(".box").nth(0);
const strategyNameInput = page.getByPlaceholder("请输入策略名称"); const strategyNameInput = page.getByPlaceholder("请输入策略名称");
...@@ -177,16 +140,9 @@ async function fillMinimalWebpageStrategyForm(page, strategyName) { ...@@ -177,16 +140,9 @@ async function fillMinimalWebpageStrategyForm(page, strategyName) {
const step2Box = page.locator(".box").nth(1); const step2Box = page.locator(".box").nth(1);
await selectElementOption(page, step2Box.locator(".el-select").nth(0), "到达特定日期时间"); await selectElementOption(page, step2Box.locator(".el-select").nth(0), "到达特定日期时间");
await selectElementOption(page, step2Box.locator(".el-select").nth(1), null); await selectElementOption(page, step2Box.locator(".el-select").nth(1), null);
await step2Box.getByRole("button", { name: "设置条件规则" }).click();
await fillConditionDrawer(page);
await expect(step2Box.getByText("重新编辑", { exact: true })).toBeVisible();
const step3Box = page.locator(".box").nth(2); const step3Box = page.locator(".box").nth(2);
const branch = step3Box.locator(".branch-item-wrapper").first(); const branch = step3Box.locator(".branch-item-wrapper").first();
await branch.getByRole("button", { name: "设置条件规则" }).click();
await fillConditionDrawer(page);
await expect(branch.getByText("重新编辑", { exact: true })).toBeVisible();
await selectElementOption(page, branch.locator(".actions-item-wrapper .el-select").first(), "向客户群发送消息"); await selectElementOption(page, branch.locator(".actions-item-wrapper .el-select").first(), "向客户群发送消息");
await branch.getByText("网页", { exact: true }).click(); await branch.getByText("网页", { exact: true }).click();
await expect(branch.getByText("网页未设置", { exact: true })).toBeVisible(); await expect(branch.getByText("网页未设置", { exact: true })).toBeVisible();
...@@ -319,6 +275,7 @@ test.describe.serial("营销推送策略 E2E", () => { ...@@ -319,6 +275,7 @@ test.describe.serial("营销推送策略 E2E", () => {
await clickRowAction(rowAfterStatusChange, "删除"); await clickRowAction(rowAfterStatusChange, "删除");
const confirmDialog = sharedPage.locator(".el-message-box:visible").last(); const confirmDialog = sharedPage.locator(".el-message-box:visible").last();
await expect(confirmDialog).toBeVisible({ timeout: 10000 });
await expect(confirmDialog).toContainText(`确定要删除策略"${strategyNameForDelete}"吗?`); await expect(confirmDialog).toContainText(`确定要删除策略"${strategyNameForDelete}"吗?`);
await confirmDialog.getByRole("button", { name: "确定" }).click(); await confirmDialog.getByRole("button", { name: "确定" }).click();
await waitForSuccessMessage(sharedPage); await waitForSuccessMessage(sharedPage);
......
...@@ -53,14 +53,6 @@ describe("marketingPushStrategy components/branchItem", () => { ...@@ -53,14 +53,6 @@ describe("marketingPushStrategy components/branchItem", () => {
jest.clearAllMocks(); jest.clearAllMocks();
}); });
it("handleBranchConditionChange 应校验 conditionGroups 字段", () => {
createWrapper();
wrapper.vm.handleBranchConditionChange();
expect(validateField).toHaveBeenCalledWith("branches[0].conditionGroups");
});
it("应透传分支删除、动作添加删除、动作变更和条件输入事件", () => { it("应透传分支删除、动作添加删除、动作变更和条件输入事件", () => {
createWrapper(); createWrapper();
......
...@@ -15,12 +15,9 @@ ...@@ -15,12 +15,9 @@
<div class="container-wrapper"> <div class="container-wrapper">
<el-form-item label="满足条件时执行:" <el-form-item label="满足条件时执行:"
label-width="150px" label-width="150px"
required :prop="`${propPrefix}.conditionGroups`">
:prop="`${propPrefix}.conditionGroups`"
:rules="[{ required: true, message: '请选择条件组', trigger: 'change', type: 'array', min: 1 }]">
<ConditionPanel :condition-variables-options="options.conditionVariables" <ConditionPanel :condition-variables-options="options.conditionVariables"
:list="branch.conditionGroups" :list="branch.conditionGroups"
@change="handleBranchConditionChange"
@input="handleBranchConditionInput" /> @input="handleBranchConditionInput" />
</el-form-item> </el-form-item>
...@@ -111,9 +108,7 @@ export default { ...@@ -111,9 +108,7 @@ export default {
}, },
methods: { methods: {
handleBranchConditionChange() {
this.elForm?.validateField(`${this.propPrefix}.conditionGroups`);
},
handleRemoveBranch() { handleRemoveBranch() {
this.$emit("removeBranch"); this.$emit("removeBranch");
}, },
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
:get-list-api="getListApi" :get-list-api="getListApi"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams"> :table-params="tableParams">
<template #executeResult="scope">
<span :class="scope.scope.executeResult == 1 ? 'success' : 'fail'">{{ baseData.executeResultOpt.find(item => item.confId == scope.scope.executeResult).confLabel }}</span>
</template>
<el-button slot="auth-button" <el-button slot="auth-button"
slot-scope="scope" slot-scope="scope"
type="text" type="text"
...@@ -74,13 +77,14 @@ export default { ...@@ -74,13 +77,14 @@ export default {
}, { }, {
label: "执行结果", label: "执行结果",
prop: "executeResult", prop: "executeResult",
formatter: (cellValue) => { addHtml: "executeResult",
const obj = { // formatter: (cellValue) => {
1: "成功", // const obj = {
2: "失败", // 1: "成功",
}; // 2: "失败",
return obj[cellValue.executeResult]; // };
}, // return obj[cellValue.executeResult];
// },
}, { }, {
label: "描述", label: "描述",
prop: "errorMessage", prop: "errorMessage",
...@@ -90,6 +94,15 @@ export default { ...@@ -90,6 +94,15 @@ export default {
detailVisible: false, detailVisible: false,
detailInfo: {}, detailInfo: {},
}, },
baseData: {
executeResultOpt: [{
confId: 1,
confLabel: "成功",
}, {
confId: 2,
confLabel: "失败",
}],
},
}; };
}, },
...@@ -122,5 +135,25 @@ export default { ...@@ -122,5 +135,25 @@ export default {
}; };
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.fail {
display: inline-block;
width: 44px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 4px;
color: #ff4d4f;
background-color: #fff2f0;
}
.success {
display: inline-block;
width: 44px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 4px;
color: #52c41a;
background-color: #f6ffed;
}
</style> </style>
...@@ -56,9 +56,6 @@ export const rules = { ...@@ -56,9 +56,6 @@ export const rules = {
relativeDateType: [ relativeDateType: [
{ required: true, message: "请选择实际触发时间", trigger: "change" }, { required: true, message: "请选择实际触发时间", trigger: "change" },
], ],
step2ConditionGroups: [
{ required: true, message: "请添加条件", trigger: "change" },
],
}; };
export function getFormSchema(that, stageOptions) { export function getFormSchema(that, stageOptions) {
return [ return [
...@@ -146,9 +143,6 @@ export function getSpecFormSchema(that, triggers, triggerMetaDates) { ...@@ -146,9 +143,6 @@ export function getSpecFormSchema(that, triggers, triggerMetaDates) {
label: "同时满足以下条件", label: "同时满足以下条件",
name: "step2ConditionGroups", name: "step2ConditionGroups",
addHtml: "step2ConditionGroups", addHtml: "step2ConditionGroups",
rules: [
{ required: true, message: "请添加条件", trigger: "change", type: "array" },
],
isHide: ({ formModel }) => { isHide: ({ formModel }) => {
return !isDateTimeTrigger(formModel.triggerType); return !isDateTimeTrigger(formModel.triggerType);
}, },
......
...@@ -80,8 +80,6 @@ describe("marketingPushStrategy views/modify/modify.data.js", () => { ...@@ -80,8 +80,6 @@ describe("marketingPushStrategy views/modify/modify.data.js", () => {
expect(dateVariableItem.isHide({ formModel: { triggerType: "OTHER" } })).toBe(true); expect(dateVariableItem.isHide({ formModel: { triggerType: "OTHER" } })).toBe(true);
expect(relativeDateTypeItem.isHide({ formModel: { triggerType: "DATE_TIME" } })).toBe(false); expect(relativeDateTypeItem.isHide({ formModel: { triggerType: "DATE_TIME" } })).toBe(false);
expect(conditionGroupsItem.isHide({ formModel: { triggerType: "OTHER" } })).toBe(true); expect(conditionGroupsItem.isHide({ formModel: { triggerType: "OTHER" } })).toBe(true);
expect(conditionGroupsItem.rules).toEqual([ expect(conditionGroupsItem.rules).toBeUndefined();
{ required: true, message: "请添加条件", trigger: "change", type: "array" },
]);
}); });
}); });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!