lw-cdp-ui 1.1.25 → 1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,16 +62,18 @@ export default [
62
62
  title: '营销目标',
63
63
  list: [
64
64
  {
65
- name: '接收事件',
65
+ name: '事件',
66
66
  icon: 'icon-event',
67
67
  type: 'event_receive',
68
- themeColor: '#39BCC5'
68
+ themeColor: '#39bcc5',
69
+ background: '#f2fcfa'
69
70
  },
70
71
  {
71
72
  name: '人群包',
72
73
  icon: 'icon-user-info',
73
74
  type: 'audience_receive',
74
- themeColor: '#39BCC5'
75
+ themeColor: '#39BCC5',
76
+ background: '#f2fcfa'
75
77
  }
76
78
  ]
77
79
  },
@@ -81,38 +83,44 @@ export default [
81
83
  {
82
84
  name: '短信',
83
85
  icon: 'icon-auto-reply',
84
- type: 'event_receive',
85
- themeColor: '#4594f3'
86
+ type: 'sms',
87
+ themeColor: '#4594f3',
88
+ background: '#f5faff'
86
89
  },
87
90
  {
88
91
  name: '微信',
89
92
  icon: 'icon-scrm-l',
90
93
  type: 'wechat',
91
- themeColor: '#4594f3'
94
+ themeColor: '#4594f3',
95
+ background: '#f5faff'
92
96
  },
93
97
  {
94
98
  name: '邮件',
95
99
  icon: 'icon-mail-l',
96
100
  type: 'email',
97
- themeColor: '#4594f3'
101
+ themeColor: '#4594f3',
102
+ background: '#f5faff'
98
103
  },
99
104
  {
100
105
  name: '权益',
101
106
  icon: 'icon-license',
102
107
  type: 'benefit',
103
- themeColor: '#4594f3'
108
+ themeColor: '#4594f3',
109
+ background: '#f5faff'
104
110
  },
105
111
  {
106
112
  name: '积分',
107
113
  icon: 'icon-coin',
108
114
  type: 'benefit',
109
- themeColor: '#4594f3'
115
+ themeColor: '#4594f3',
116
+ background: '#f5faff'
110
117
  },
111
118
  {
112
119
  name: '优惠券',
113
120
  icon: 'icon--coupon-2',
114
121
  type: 'coupon',
115
- themeColor: '#4594f3'
122
+ themeColor: '#4594f3',
123
+ background: '#f5faff'
116
124
  }
117
125
  ]
118
126
  },
@@ -365,8 +365,11 @@ export default {
365
365
  case 'reduce':
366
366
  await et2lTable(this.logicFlow, node);
367
367
  break;
368
+ case 'event_receive':
369
+ await nodeCustom(this.logicFlow, node, this.$store.state);
370
+ break;
368
371
  default:
369
- await nodeCustom(this.logicFlow, node);
372
+ await nodeCustom(this.logicFlow, node, this.$store.state);
370
373
  break;
371
374
  }
372
375
  }
@@ -0,0 +1,262 @@
1
+ <template>
2
+ <lw-form ref="dataFormRef"
3
+ :config="config"
4
+ v-model="dataForm">
5
+ <!-- 选择人群 -->
6
+ <template #audienceIdSelect>
7
+ <div class="form-item">
8
+ <el-select v-model="dataForm.audienceId"
9
+ filterable
10
+ @change="onChangeAudience"
11
+ placeholder="请选择">
12
+ <el-option v-for="item in audienceIdOptions"
13
+ :key="item.value"
14
+ :label="item.label"
15
+ :value="item.value" />
16
+ </el-select>
17
+ <span v-if="!dataForm.snapshotId"
18
+ class="span-top">
19
+ 预估人数
20
+ {{ audienceEstimate !== "" ? audienceEstimate : "--" }} 人</span>
21
+ </div>
22
+ </template>
23
+ <!-- 人群快照 -->
24
+ <template #snapshotIdSelect>
25
+ <div class="form-item">
26
+ <el-select v-model="dataForm.snapshotId"
27
+ filterable
28
+ @change="onChangeSnapshot"
29
+ placeholder="请选择">
30
+ <el-option v-for="item in snapshotIdOptions"
31
+ :key="item.value"
32
+ :label="item.label"
33
+ :value="item.value" />
34
+ </el-select>
35
+ <span class="span-top"
36
+ v-if="!!dataForm.snapshotId">预估人数
37
+ {{ snapshotEstimate !== "" ? snapshotEstimate : "--" }} 人</span>
38
+ </div>
39
+ </template>
40
+ <!-- 触发时间 -->
41
+ <template #scheduleTime>
42
+ <div class="form-item">
43
+ <el-date-picker v-model="dataForm.schedule.date"
44
+ type="datetime"
45
+ format="YYYY-MM-DD HH:mm:ss"
46
+ value-format="YYYY-MM-DDTHH:mm:ss.000ZZ"
47
+ placeholder="请选择"></el-date-picker>
48
+ <span class="text">开始活动</span>
49
+ </div>
50
+
51
+ </template>
52
+ <template #scheduleDate>
53
+ <el-date-picker v-model="dataForm.startEndTime"
54
+ type="daterange"
55
+ format="YYYY-MM-DD"
56
+ start-placeholder="开始日期"
57
+ end-placeholder="结束日期"
58
+ value-format="YYYY-MM-DD"
59
+ placeholder="请选择"
60
+ @change="changeDatetimerange"
61
+ style="margin-bottom: 5px;"></el-date-picker>
62
+ <lwCronSelect v-model="dataForm.schedule.cron" />
63
+ </template>
64
+
65
+ <span></span>
66
+ </lw-form>
67
+ </template>
68
+
69
+ <script>
70
+ import nodeDatas from '../nodesData/index.js'
71
+ import dayjs from 'dayjs'
72
+
73
+ export default {
74
+ name: 'audienceReceive',
75
+ data() {
76
+ return {
77
+ dataForm: {
78
+ schedule: {}
79
+ },
80
+ ...nodeDatas,
81
+ audienceIdOptions: [],
82
+ snapshotIdOptions: [],
83
+ audienceEstimate: '',
84
+ snapshotEstimate: '',
85
+ }
86
+ },
87
+ props: {
88
+ modelValue: {
89
+ type: Object,
90
+ default: () => {
91
+ return {}
92
+ }
93
+ },
94
+ lf: {
95
+ type: Object,
96
+ default: () => { }
97
+ },
98
+ type: {
99
+ type: String,
100
+ default: ''
101
+ }
102
+ },
103
+ watch: {
104
+ modelValue: {
105
+ handler(val) {
106
+ if (val) {
107
+ this.dataForm = val
108
+ }
109
+
110
+ },
111
+ immediate: true,
112
+ deep: true
113
+ },
114
+ dataForm: {
115
+ handler(val, old) {
116
+ if (Object.keys(old).length > 0) {
117
+ this.$emit('update:modelValue', val)
118
+ }
119
+
120
+ },
121
+ deep: true
122
+ }
123
+ },
124
+ computed: {
125
+ config() {
126
+ let config = {
127
+ labelWidth: '70px',
128
+ labelPosition: 'top',
129
+ formItems: [
130
+ {
131
+ label: '节点名称',
132
+ name: 'name',
133
+ value: '',
134
+ component: 'input',
135
+ options: {
136
+ placeholder: '请输入节点名称',
137
+ },
138
+ span: 24
139
+ }
140
+ ]
141
+ }
142
+
143
+ // 拿到对应节点的表单配置
144
+ let nodeConfig = nodeDatas[this.type]?.formConfig || {}
145
+ if (nodeConfig?.labelWidth) {
146
+ config.labelWidth = nodeConfig.labelWidth
147
+ }
148
+ if (nodeConfig?.labelPosition) {
149
+ config.labelPosition = nodeConfig.labelPosition
150
+ }
151
+
152
+ // 处理需要接口的内容
153
+ if (!this.$store.state[`lwFlow_${this.type}`]) {
154
+ this.$store.state[`lwFlow_${this.type}`] = {}
155
+ }
156
+ nodeConfig.formItems.forEach(async item => {
157
+ if (item?.options?.items) {
158
+ if (item.api) {
159
+ let items = await item.api(this.$http)
160
+ item.options.items = items || []
161
+ }
162
+
163
+ // 全局化选项内容 用于回显数据
164
+ if (item?.options?.name) {
165
+ this.$store.state[`lwFlow_${this.type}`][`${item.name}.${item.options.name}`] = item?.options?.items || ''
166
+ } else {
167
+ this.$store.state[`lwFlow_${this.type}`][item.name] = item?.options?.items || ''
168
+ }
169
+ }
170
+ })
171
+
172
+ if (nodeConfig?.formItems) {
173
+ config.formItems = nodeConfig.formItems
174
+ }
175
+
176
+ return config
177
+ }
178
+ },
179
+ methods: {
180
+ async getaudienceId(value) {
181
+ const params = { fields: 'name,usageType', expression: 'usageType ne TEST' }
182
+ if (value) {
183
+ params.expression = `AND name like ${value}`
184
+ }
185
+ let list = await this.$http.get(`/api/ma-manage/{tenantId}/{buCode}/audience/list`, params)
186
+
187
+ list = list.map((item) => ({
188
+ value: item.id,
189
+ label: `[${item.name}] ${item.id}`
190
+ }))
191
+ // 全局化选项内容 用于回显数据
192
+ this.$store.state[`lwFlow_audience_receive`]['audienceId'] = list
193
+ this.audienceIdOptions = list
194
+ },
195
+ async getSnapshotList(audienceId) {
196
+ let params = {}
197
+ if (audienceId) {
198
+ params = { expression: `audienceId eq ${audienceId}` }
199
+ }
200
+ let { content } = await this.$http.get(`/api/ma-manage/{tenantId}/{buCode}/audience/snapshot`, params)
201
+
202
+ let list = content.map((item) => ({
203
+ value: item.id,
204
+ num: item.num,
205
+ label: dayjs(item.createDate).format('YYYY-MM-DD HH:mm:ss')
206
+ }))
207
+ // 全局化选项内容 用于回显数据
208
+ this.$store.state[`lwFlow_audience_receive`]['snapshotId'] = list
209
+ this.snapshotIdOptions = list
210
+ },
211
+ async onChangeAudience(value) {
212
+ this.getSnapshotList(value)
213
+ this.dataForm.snapshotId = ''
214
+ this.audienceEstimate = await this.$http.get(`/api/ma-manage/{tenantId}/{buCode}/audience/${value}/count-customers`)
215
+ },
216
+ async onChangeSnapshot(value) {
217
+ this.snapshotEstimate = this.snapshotIdOptions.find(item => item.value === value).num
218
+ this.dataForm.snapshotName = this.snapshotIdOptions.find(item => item.value === value).label
219
+ },
220
+ changeDatetimerange(val) {
221
+ if (val) {
222
+ [this.dataForm.schedule.startTime, this.dataForm.schedule.endTime] = val
223
+ } else {
224
+ this.dataForm.schedule.startTime = ''
225
+ this.dataForm.schedule.endTime = ''
226
+ }
227
+ }
228
+ },
229
+ mounted() {
230
+ this.getaudienceId()
231
+ if (this.dataForm?.audienceId) {
232
+ this.getSnapshotList(this.dataForm.audienceId)
233
+ }
234
+
235
+ }
236
+ }
237
+
238
+ </script>
239
+
240
+ <style lang="scss" scoped>
241
+ .form-item {
242
+ position: relative;
243
+ width: 100%;
244
+ display: flex;
245
+ align-items: center;
246
+ gap: 5px;
247
+ .span-top {
248
+ position: absolute;
249
+ top: -15px;
250
+ right: 0;
251
+ padding: 3px 5px;
252
+ background-color: var(--el-color-primary);
253
+ color: #ffffff;
254
+ font-size: 10px;
255
+ line-height: 10px;
256
+ }
257
+ .text {
258
+ font-size: 12px;
259
+ color: #999999;
260
+ }
261
+ }
262
+ </style>
@@ -34,6 +34,7 @@
34
34
  </template>
35
35
  </lwTableForm>
36
36
  </template>
37
+
37
38
  <span></span>
38
39
  </lw-form>
39
40
  </template>
@@ -112,6 +113,27 @@ export default {
112
113
  if (nodeConfig?.labelPosition) {
113
114
  config.labelPosition = nodeConfig.labelPosition
114
115
  }
116
+
117
+ // 处理需要接口的内容
118
+ if (!this.$store.state[`lwFlow_${this.type}`]) {
119
+ this.$store.state[`lwFlow_${this.type}`] = {}
120
+ }
121
+ nodeConfig.formItems.forEach(async item => {
122
+ if (item?.options?.items) {
123
+ if (item.api) {
124
+ let items = await item.api(this.$http)
125
+ item.options.items = items || []
126
+ }
127
+
128
+ // 全局化选项内容 用于回显数据
129
+ if (item?.options?.name) {
130
+ this.$store.state[`lwFlow_${this.type}`][`${item.name}.${item.options.name}`] = item?.options?.items || ''
131
+ } else {
132
+ this.$store.state[`lwFlow_${this.type}`][item.name] = item?.options?.items || ''
133
+ }
134
+ }
135
+ })
136
+
115
137
  if (nodeConfig?.formItems) {
116
138
  config.formItems = nodeConfig.formItems
117
139
  }
@@ -120,15 +142,6 @@ export default {
120
142
  }
121
143
  },
122
144
  methods: {
123
- changeFontWeight() {
124
- this.dataForm.fontWeight = this.dataForm.fontWeight === 'bold' ? 'normal' : 'bold'
125
- },
126
- changeTextDecoration() {
127
- this.dataForm.textDecoration = this.dataForm.textDecoration === 'underline' ? 'none' : 'underline'
128
- },
129
- changeFontStyle() {
130
- this.dataForm.fontStyle = this.dataForm.fontStyle === 'italic' ? 'normal' : 'italic'
131
- },
132
145
  }
133
146
  }
134
147
 
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <lw-form ref="dataFormRef"
3
+ :config="config"
4
+ v-model="dataForm">
5
+ <!-- 选择事件 -->
6
+ <template #behaviorIdSelect>
7
+ <el-select v-model="dataForm.behaviorId"
8
+ filterable
9
+ @change="onChangeBehavior"
10
+ placeholder="请选择">
11
+ <el-option v-for="item in behaviorIdOptions"
12
+ :key="item.value"
13
+ :label="item.label"
14
+ :value="item.value" />
15
+ </el-select>
16
+ </template>
17
+
18
+ <!-- 去重 -->
19
+ <template #uniqueField>
20
+ <el-switch v-model="dataForm.unique"
21
+ type="round" />
22
+ <el-tree-select v-if="dataForm.unique"
23
+ v-model="dataForm.uniqueField"
24
+ filterable
25
+ default-expand-all
26
+ :data="dataModelFields"
27
+ :check-strictly="true"
28
+ :props="{ label: 'label', value: 'path', children: 'fields' }"
29
+ placeholder="请选择字段" />
30
+ </template>
31
+
32
+ <span></span>
33
+ </lw-form>
34
+ </template>
35
+
36
+ <script>
37
+ import nodeDatas from '../nodesData/index.js'
38
+ export default {
39
+ name: 'basicSettings',
40
+ data() {
41
+ return {
42
+ dataForm: {},
43
+ ...nodeDatas,
44
+ behaviorIdOptions: [],
45
+ dataModelFields: [],
46
+ }
47
+ },
48
+ props: {
49
+ modelValue: {
50
+ type: Object,
51
+ default: () => {
52
+ return {}
53
+ }
54
+ },
55
+ lf: {
56
+ type: Object,
57
+ default: () => { }
58
+ },
59
+ type: {
60
+ type: String,
61
+ default: ''
62
+ }
63
+ },
64
+ watch: {
65
+ modelValue: {
66
+ handler(val) {
67
+ if (val) {
68
+ this.dataForm = val
69
+ }
70
+
71
+ },
72
+ immediate: true,
73
+ deep: true
74
+ },
75
+ dataForm: {
76
+ handler(val, old) {
77
+ if (Object.keys(old).length > 0) {
78
+ this.$emit('update:modelValue', val)
79
+ }
80
+
81
+ },
82
+ deep: true
83
+ }
84
+ },
85
+ computed: {
86
+ config() {
87
+ let config = {
88
+ labelWidth: '70px',
89
+ labelPosition: 'top',
90
+ formItems: [
91
+ {
92
+ label: '节点名称',
93
+ name: 'name',
94
+ value: '',
95
+ component: 'input',
96
+ options: {
97
+ placeholder: '请输入节点名称',
98
+ },
99
+ span: 24
100
+ }
101
+ ]
102
+ }
103
+
104
+ // 拿到对应节点的表单配置
105
+ let nodeConfig = nodeDatas[this.type]?.formConfig || {}
106
+ if (nodeConfig?.labelWidth) {
107
+ config.labelWidth = nodeConfig.labelWidth
108
+ }
109
+ if (nodeConfig?.labelPosition) {
110
+ config.labelPosition = nodeConfig.labelPosition
111
+ }
112
+
113
+ // 处理需要接口的内容
114
+ if (!this.$store.state[`lwFlow_${this.type}`]) {
115
+ this.$store.state[`lwFlow_${this.type}`] = {}
116
+ }
117
+ nodeConfig.formItems.forEach(async item => {
118
+ if (item?.options?.items) {
119
+ if (item.api) {
120
+ let items = await item.api(this.$http)
121
+ item.options.items = items || []
122
+ }
123
+
124
+ // 全局化选项内容 用于回显数据
125
+ if (item?.options?.name) {
126
+ this.$store.state[`lwFlow_${this.type}`][`${item.name}.${item.options.name}`] = item?.options?.items || ''
127
+ } else {
128
+ this.$store.state[`lwFlow_${this.type}`][item.name] = item?.options?.items || ''
129
+ }
130
+ }
131
+ })
132
+
133
+ if (nodeConfig?.formItems) {
134
+ config.formItems = nodeConfig.formItems
135
+ }
136
+
137
+ return config
138
+ }
139
+ },
140
+ methods: {
141
+ // 获取事件列表
142
+ async getBehaviorList() {
143
+ const params = { fields: "name,modelId,status" };
144
+ params.expression = `status in ENABLED`
145
+ let list = await this.$http.get(`/api/ma-manage/{tenantId}/{buCode}/behavior-event/list`, params)
146
+
147
+ list = list.map((item) => ({
148
+ value: item.id,
149
+ label: item.name,
150
+ ...item
151
+ }))
152
+ // 全局化选项内容 用于回显数据
153
+ this.$store.state[`lwFlow_event_receive`]['behaviorId'] = list
154
+ this.behaviorIdOptions = list
155
+ },
156
+ onChangeBehavior(value) {
157
+ const behavior = this.behaviorIdOptions.find(it => { return it.value === value });
158
+
159
+ if (behavior) {
160
+ this.dataForm.behaviorModelId = behavior.modelId;
161
+ this.dataForm.eventName = behavior.name;
162
+ this.dataForm.uniqueField = ''
163
+ this.findBehaviorModel(behavior.modelId);
164
+ }
165
+ },
166
+ async findBehaviorModel(id) {
167
+ let dataModel = await this.$http.get(`/api/ma-manage/{tenantId}/{buCode}/behavior-model/${id}`)
168
+ // 全局化选项内容 用于回显数据
169
+ this.$store.state[`lwFlow_event_receive`]['uniqueField'] = []
170
+ this.dataModelFields = this.formatFields(dataModel.fields)
171
+ },
172
+ formatFields(fields, parent) {
173
+ const result = [];
174
+ if (!Array.isArray(fields)) return result;
175
+ fields.forEach((item) => {
176
+ const field = JSON.parse(JSON.stringify(item))
177
+ if (parent) {
178
+ field.path = `${parent.path}.${item.name}`;
179
+ } else {
180
+ field.path = item.name;
181
+ }
182
+ if (item.aliasName) {
183
+ field.label = `「${item.aliasName}」${item.name}`;
184
+ } else {
185
+ field.label = `${item.name}`;
186
+ }
187
+
188
+ if (item.fields && item.fields.length > 0) {
189
+ field.fields = this.formatFields(item.fields, field);
190
+ }
191
+ this.$store.state[`lwFlow_event_receive`]['uniqueField'].push(field);
192
+ result.push(field);
193
+ });
194
+ return result;
195
+ }
196
+ },
197
+ mounted() {
198
+ this.getBehaviorList()
199
+ if (this.dataForm?.behaviorModelId) {
200
+ this.findBehaviorModel(this.dataForm.behaviorModelId);
201
+ }
202
+
203
+ }
204
+ }
205
+
206
+ </script>
@@ -9,10 +9,34 @@
9
9
  accordion>
10
10
  <el-collapse-item title="基础信息"
11
11
  name="basicInfo">
12
- <basicSettings ref="basicSettingsRef"
13
- v-model="dataForm.properties.data"
14
- :type="nodeData.type"
15
- :lf="lf" />
12
+
13
+ <!-- 营销目标 -->
14
+ <template v-if="['audience_receive'].includes(nodeData.type)">
15
+ <audienceReceive ref="dataFormRef"
16
+ v-model="dataForm.properties.data"
17
+ :type="nodeData.type"
18
+ :lf="lf" />
19
+ </template>
20
+ <template v-if="['event_receive'].includes(nodeData.type)">
21
+ <eventReceive ref="dataFormRef"
22
+ v-model="dataForm.properties.data"
23
+ :type="nodeData.type"
24
+ :lf="lf" />
25
+ </template>
26
+ <template v-if="['sms'].includes(nodeData.type)">
27
+ <sms ref="dataFormRef"
28
+ v-model="dataForm.properties.data"
29
+ :type="nodeData.type"
30
+ :lf="lf" />
31
+ </template>
32
+ <!-- 默认 -->
33
+ <template v-else>
34
+ <basicSettings ref="dataFormRef"
35
+ v-model="dataForm.properties.data"
36
+ :type="nodeData.type"
37
+ :lf="lf" />
38
+ </template>
39
+
16
40
  </el-collapse-item>
17
41
  <el-collapse-item title="样式设置"
18
42
  name="styleSettings">
@@ -35,11 +59,18 @@
35
59
 
36
60
  </template>
37
61
  <script>
62
+ import audienceReceive from './audienceReceive.vue'
63
+ import eventReceive from './eventReceive.vue'
64
+ import sms from './sms.vue'
38
65
  import basicSettings from './basicSettings.vue'
39
66
  import styleSettings from './styleSettings.vue'
67
+
40
68
  export default {
41
69
  name: 'drawerForm',
42
70
  components: {
71
+ audienceReceive,
72
+ eventReceive,
73
+ sms,
43
74
  basicSettings,
44
75
  styleSettings
45
76
  },
@@ -77,7 +108,7 @@ export default {
77
108
  },
78
109
  methods: {
79
110
  async onSubmit() {
80
- await this.$refs.basicSettingsRef.$refs.dataFormRef.validate();
111
+ await this.$refs.dataFormRef.$refs.dataFormRef.validate();
81
112
  const { id } = this.dataForm
82
113
  this.lf.setProperties(id, {
83
114
  ...this.dataForm.properties