Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
marketing-web
marketing
Commits
6478c07a
Commit
6478c07a
authored
Mar 28, 2022
by
crushh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: dist
parent
0f178f0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
41 deletions
+108
-41
createParams.js
src/views/ai/createParams.js
+53
-3
form.vue
src/views/ai/form.vue
+5
-1
ruleFilter.vue
src/views/ai/ruleFilter.vue
+50
-37
No files found.
src/views/ai/
parse-property
.js
→
src/views/ai/
createParams
.js
View file @
6478c07a
...
...
@@ -8,7 +8,7 @@
* @return {Boolean} map.isCategray 是否是不是属性
* @return {Boolean} map.notProperty 是否是类别属性
*/
export
default
val
=>
{
function
parseProperty
(
val
)
{
// 用二进制对应位上的1表示对应属性的开启状态
// {
// 1: '0001', // 计算属性
...
...
@@ -19,9 +19,59 @@ export default val => {
// }
// 将val转为二进制,来处理值之和的情况,例如:3 = 1 + 2 = 0001 + 0010 = 0011
// 然后再把二进制值的字符串转为数字,调转顺序,0 1转为bool
const
status
=
Number
(
val
).
toString
(
2
).
split
(
''
).
reverse
().
map
(
i
=>
i
==
1
)
const
status
=
Number
(
val
)
.
toString
(
2
)
.
split
(
''
)
.
reverse
()
.
map
(
i
=>
i
==
1
);
// 根据上面的键值对表,从二进制最末一位开始,对应在数组里
const
keys
=
[
'isCompute'
,
'isField'
,
'isValue'
,
'isCategray'
,
'notProperty'
]
const
keys
=
[
'isCompute'
,
'isField'
,
'isValue'
,
'isCategray'
,
'notProperty'
]
;
// 根据数组转换出状态结果
return
keys
.
reduce
((
map
,
key
,
index
)
=>
({
...
map
,
[
key
]:
!!
status
[
index
]
}),
{});
}
function
getParamsData
(
node
)
{
const
result
=
{
key
:
''
,
compute
:
''
,
value
:
''
};
const
property
=
parseProperty
(
node
.
property
);
if
(
property
.
isField
)
{
result
.
key
=
node
.
columnKey
;
// console.log(result.key)
}
// isCompute 是否是计算属性
// 计算属性的值来源:computeCharacter或是选择的值
if
(
property
.
isCompute
)
{
result
.
compute
=
node
.
computeCharacter
;
}
// notProperty 是否是类别属性
// 类别属性 dealkey有值就带上,和value key同级,如果没值要删掉
if
(
property
.
notProperty
&&
node
.
dealKey
)
{
result
.
dealKey
=
node
.
dealKey
;
}
result
.
value
=
node
.
value
;
return
{
type
:
'data'
,
data
:
result
};
}
/**
* @description 将数据转换成后端需要的数据、缩略信息数据
* @param {Object} data 选择好的筛选条件数据
* @return {Array} result.filterJson 后端需要的查询条件
* @return {Array} result.filterFrontShow 前端回显的数据
*/
const
transform
=
(
data
,
scenes
)
=>
{
const
result
=
{
filterJson
:
[],
// 后台需要的查询条件
filterFrontShow
:
[],
// 前端回显的数据
scenes
:
scenes
// 场景值 member02
};
const
obj
=
{
list
:
[],
type
:
'and'
};
let
arr
=
[];
data
.
forEach
(
item
=>
{
if
(
item
.
value
)
{
obj
.
list
.
push
({
type
:
'or'
,
list
:
[
getParamsData
(
item
)]
});
arr
.
push
(
item
);
}
});
result
.
filterJson
=
JSON
.
stringify
(
obj
);
result
.
filterFrontShow
=
JSON
.
stringify
(
arr
);
return
result
;
};
export
default
transform
;
src/views/ai/form.vue
View file @
6478c07a
...
...
@@ -30,7 +30,7 @@
<div>
<div
class=
"tips"
v-if=
"form.scene == 4"
>
默认为权限范围内的全部客户
</div>
<el-button
v-if=
"form.memberType == 0 && form.scene != 4"
size=
"small"
@
click=
"ruleVisible = true"
>
添加其他条件
</el-button>
<ruleFilter
:visiable
.
sync=
"ruleVisible"
/>
<ruleFilter
:visiable
.
sync=
"ruleVisible"
@
save=
"handleRuleFilterSave"
:memberCrowdWidgetId=
"form.filterJson"
/>
<el-button
v-if=
"form.memberType == 1 && !selectedGroup.length && form.scene != 4"
size=
"small"
@
click=
"groupVisible = true"
>
添加分组
</el-button>
<gic-new-member-group
:visiable
.
sync=
"groupVisible"
:defaltSelected=
"selectedGroup"
@
change=
"confirmGroupDialog"
/>
</div>
...
...
@@ -565,6 +565,10 @@ export default {
const
{
result
}
=
await
getMemberCount
(
data
);
this
.
form
.
planMemberCount
=
result
;
},
/**客户筛选 */
handleRuleFilterSave
(
id
)
{
this
.
form
.
filterJson
=
id
;
},
/**客户分组 */
confirmGroupDialog
(
arr
,
idStr
)
{
this
.
selectedGroup
=
arr
;
...
...
src/views/ai/ruleFilter.vue
View file @
6478c07a
...
...
@@ -6,14 +6,14 @@
<el-tab-pane
:label=
"item.chainNodeName"
v-for=
"item in conditionTypeList"
:key=
"item.esScreeningWidgetChainId"
:name=
"item.esScreeningWidgetChainId"
>
<div
v-if=
"templateCode == 'tag001'"
class=
"leftContent"
>
<el-checkbox-group
v-model=
"item.selectValue"
@
change=
"val => handleChange(val, item.esScreeningWidgetChainId)"
class=
"checkBoxContainer"
>
<el-checkbox
v-for=
"row in item.selectList"
:key=
"row.key"
:label=
"row.
value
"
>
{{
row
.
value
}}
</el-checkbox>
<el-checkbox
v-for=
"row in item.selectList"
:key=
"row.key"
:label=
"row.
key
"
>
{{
row
.
value
}}
</el-checkbox>
</el-checkbox-group>
</div>
<div
v-if=
"templateCode == 'com026'"
class=
"leftContent"
>
<div
class=
"line"
v-for=
"(value, index) in item.selectList"
:key=
"index"
>
<h3>
{{
value
.
title
}}
</h3>
<el-checkbox-group
v-model=
"item.selectValue"
@
change=
"val => handleChange(val, item.esScreeningWidgetChainId)"
class=
"checkBoxContainer"
>
<el-checkbox
v-for=
"row in value.data"
:key=
"row.key"
:label=
"row.
value"
>
{{
row
.
key
}}
</el-checkbox>
<el-checkbox
v-for=
"row in value.data"
:key=
"row.key"
:label=
"row.
key"
>
{{
row
.
value
}}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
...
...
@@ -46,7 +46,7 @@
<
script
>
import
qs
from
'qs'
;
import
parseProperty
from
'./parse-property
.js'
;
import
transform
from
'./createParams
.js'
;
export
default
{
data
()
{
return
{
...
...
@@ -55,17 +55,44 @@ export default {
checkboxList
:
[],
arr
:
[],
uuid
:
''
,
templateCode
:
''
//当前控件类型
templateCode
:
''
,
//当前控件类型
echoFlag
:
false
};
},
props
:
{
visiable
:
{
type
:
Boolean
,
default
:
false
},
sceneCode
:
{
type
:
String
,
default
:
'member02'
},
requestProject
:
{
type
:
String
,
default
:
'gic-web'
},
memberCrowdWidgetId
:
{
type
:
[
String
,
Number
],
default
:
''
}
},
mounted
()
{
this
.
getDataList
();
this
.
getEchoData
();
},
watch
:
{
memberCrowdWidgetId
:
{
immediate
:
true
,
handler
(
newval
)
{
if
(
newval
&&
this
.
echoFlag
)
{
/**
* 回显数据请求 echoFlag 为真且memberCrowdWidgetId不为空 然后使用memberCrowdWidgetId来查回显的数据
**/
this
.
getEchoData
();
}
}
}
},
computed
:
{
selectData
()
{
...
...
@@ -77,6 +104,13 @@ export default {
}
},
methods
:
{
getEchoData
()
{
// "ff8080817fab027b017fce8c4cac26ab"
const
data
=
{
memberCrowdWidgetId
:
'ff8080817fab027b017fcf080dd8275d'
};
this
.
axios
.
post
(
`api-plug/query-member-crowd-new?requestProject=
${
this
.
requestProject
}
`
,
data
).
then
(
res
=>
{
console
.
log
(
res
);
});
},
handleChange
(
val
,
id
)
{
this
.
conditionTypeList
.
find
(
item
=>
item
.
esScreeningWidgetChainId
==
id
).
value
=
val
.
join
(
','
);
console
.
log
(
this
.
conditionTypeList
);
...
...
@@ -94,43 +128,22 @@ export default {
this
.
$emit
(
'update:visiable'
,
false
);
},
confirm
()
{
this
.
handleConfirmData
();
// this.axios.post('/save-member-crowd-new', para).then(res => {});
},
handleConfirmData
()
{
let
arr
=
[];
this
.
conditionTypeList
.
forEach
(
item
=>
{
if
(
item
.
value
)
{
arr
.
push
(
this
.
getParamsData
(
item
));
const
data
=
transform
(
this
.
conditionTypeList
,
this
.
sceneCode
);
console
.
log
(
data
);
this
.
axios
.
post
(
`api-plug/save-member-crowd-new?requestProject=
${
this
.
requestProject
}
`
,
data
).
then
(
res
=>
{
let
resData
=
res
.
data
;
if
(
resData
.
errorCode
==
0
)
{
this
.
$emit
(
'save'
,
resData
.
result
);
this
.
echoFlag
=
true
;
}
});
console
.
log
(
arr
);
},
getParamsData
(
node
)
{
const
result
=
{
key
:
''
,
compute
:
''
,
value
:
''
};
const
property
=
parseProperty
(
node
.
property
);
if
(
property
.
isField
)
{
result
.
key
=
node
.
columnKey
;
// console.log(result.key)
}
// isCompute 是否是计算属性
// 计算属性的值来源:computeCharacter或是选择的值
if
(
property
.
isCompute
)
{
result
.
compute
=
node
.
computeCharacter
;
}
// notProperty 是否是类别属性
// 类别属性 dealkey有值就带上,和value key同级,如果没值要删掉
if
(
property
.
notProperty
&&
node
.
dealKey
)
{
result
.
dealKey
=
node
.
dealKey
;
}
result
.
value
=
node
.
value
;
return
result
;
},
// 获取列表
getDataList
()
{
let
para
=
{
sceneCode
:
'member02'
,
requestProject
:
'gic-web'
sceneCode
:
this
.
sceneCode
,
requestProject
:
this
.
requestProject
};
this
.
axios
.
post
(
'/api-plug/get-screening-init-data'
,
qs
.
stringify
(
para
))
...
...
@@ -169,7 +182,7 @@ export default {
},
getNode
(
widgetChainId
)
{
// 第二层节点的控件类型
this
.
axios
.
get
(
`/api-plug/get-screening-widget-chain-detail?requestProject=
gic-web
&widgetChainId=
${
widgetChainId
}
`
).
then
(
res
=>
{
this
.
axios
.
get
(
`/api-plug/get-screening-widget-chain-detail?requestProject=
${
this
.
requestProject
}
&widgetChainId=
${
widgetChainId
}
`
).
then
(
res
=>
{
const
{
esScreeningWidgetChainId
,
widget
:
{
sourceFlag
,
templateCode
,
widgetParam
,
widgetValues
},
...
...
@@ -190,7 +203,7 @@ export default {
// 使用接口获取 第二层控件类型的内容
getChildNode
(
url
,
key
,
id
)
{
const
param
=
{
requestProject
:
'gic-web'
,
requestProject
:
this
.
requestProject
,
key
};
this
.
axios
.
post
(
`
${
url
}
`
,
qs
.
stringify
(
param
)).
then
(
res
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment