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
0f178f0a
Commit
0f178f0a
authored
Mar 25, 2022
by
crushh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate: dist
parent
b8eae1e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
28 deletions
+108
-28
parse-property.js
src/views/ai/parse-property.js
+27
-0
ruleFilter.vue
src/views/ai/ruleFilter.vue
+81
-28
No files found.
src/views/ai/parse-property.js
0 → 100644
View file @
0f178f0a
/**
* 解析property
* @param {Number | String} val property值,也可能是多个对应值之和
* @return {Object} map
* @return {Boolean} map.isCompute 是否是计算属性
* @return {Boolean} map.isField 是否是字段属性
* @return {Boolean} map.isValue 是否是值属性
* @return {Boolean} map.isCategray 是否是不是属性
* @return {Boolean} map.notProperty 是否是类别属性
*/
export
default
val
=>
{
// 用二进制对应位上的1表示对应属性的开启状态
// {
// 1: '0001', // 计算属性
// 2: '0010', // 字段属性
// 4: '0100', // 值属性
// 8: '1000', // 不是属性
// 16: '00010000', // 类别属性
// }
// 将val转为二进制,来处理值之和的情况,例如:3 = 1 + 2 = 0001 + 0010 = 0011
// 然后再把二进制值的字符串转为数字,调转顺序,0 1转为bool
const
status
=
Number
(
val
).
toString
(
2
).
split
(
''
).
reverse
().
map
(
i
=>
i
==
1
)
// 根据上面的键值对表,从二进制最末一位开始,对应在数组里
const
keys
=
[
'isCompute'
,
'isField'
,
'isValue'
,
'isCategray'
,
'notProperty'
]
// 根据数组转换出状态结果
return
keys
.
reduce
((
map
,
key
,
index
)
=>
({
...
map
,
[
key
]:
!!
status
[
index
]
}),
{});
}
src/views/ai/ruleFilter.vue
View file @
0f178f0a
...
...
@@ -5,20 +5,20 @@
<el-tabs
tab-position=
"left"
@
tab-click=
"onTabsClick"
v-model=
"activeName"
>
<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=
"
selectData[item.chainNodeName]"
@
change=
"handleChange
"
class=
"checkBoxContainer"
>
<el-checkbox
v-for=
"row in
checkboxList"
:key=
"row.key"
:label=
"row.key
"
>
{{
row
.
value
}}
</el-checkbox>
<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-group>
</div>
<div
v-if=
"templateCode == 'com026'"
class=
"leftContent"
>
<div
class=
"line"
v-for=
"(value, index) in
checkbox
List"
:key=
"index"
>
<div
class=
"line"
v-for=
"(value, index) in
item.select
List"
:key=
"index"
>
<h3>
{{
value
.
title
}}
</h3>
<el-checkbox-group
v-model=
"
selectData[item.chainNodeName]"
@
change=
"handleChange
"
class=
"checkBoxContainer"
>
<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-group>
</div>
</div>
<div
v-if=
"templateCode == 'com020'"
class=
"leftContent"
>
<
dm-store-selector
style=
"margin-top: 20px;"
ref=
"newStoreCard"
:uuid
.
sync=
"uuid"
></dm-store-selector
>
<
vue-gic-store-new
:isAdd=
"isAdd"
:creatorId=
"creatorId"
:scenesVal=
"scenes"
scenes=
"auth"
:uuid=
"item.value"
ref=
"storeNew"
@
store-change=
"storeChange"
></vue-gic-store-new
>
</div>
</el-tab-pane>
</el-tabs>
...
...
@@ -28,13 +28,10 @@
已选条件
</div>
<ul
class=
"right-content"
>
<li
class=
"contact-li"
v-for=
"(value, name) in selectData"
:key=
"name"
>
{{
name
}}
<div
class=
"li-cell cursor-pointer"
>
<div>
<span
v-for=
"item in value"
:key=
"item"
>
{{
item
}}
</span>
</div>
<i
v-if=
"!readonly"
class=
"el-icon-close"
@
click=
"deleteRow(item)"
></i>
<li
class=
"contact-li"
v-for=
"(item, index) in selectData"
:key=
"index"
>
<div
class=
"li-cell cursor-pointer"
>
{{
item
.
chainNodeName
}}
<i
v-if=
"!readonly"
class=
"el-icon-close"
@
click=
"deleteRow(item)"
></i></div>
<div>
<span
v-for=
"row in item.selectValue"
:key=
"row"
>
{{
row
}}
</span>
</div>
</li>
</ul>
...
...
@@ -42,20 +39,20 @@
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"close"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirm
TagsDialog
"
>
确定
</el-button>
<el-button
type=
"primary"
@
click=
"confirm"
>
确定
</el-button>
</div>
</el-dialog>
</
template
>
<
script
>
import
qs
from
'qs'
;
import
parseProperty
from
'./parse-property.js'
;
export
default
{
data
()
{
return
{
activeName
:
''
,
conditionTypeList
:
[],
// 第一层级
checkboxList
:
[],
selectData
:
{},
arr
:
[],
uuid
:
''
,
templateCode
:
''
//当前控件类型
...
...
@@ -70,10 +67,23 @@ export default {
mounted
()
{
this
.
getDataList
();
},
computed
:
{
selectData
()
{
const
data
=
[];
this
.
conditionTypeList
.
forEach
(
item
=>
{
data
.
push
({
chainNodeName
:
item
.
chainNodeName
,
selectValue
:
item
.
selectValue
});
});
return
data
;
}
},
methods
:
{
handleChange
(
val
)
{
handleChange
(
val
,
id
)
{
this
.
conditionTypeList
.
find
(
item
=>
item
.
esScreeningWidgetChainId
==
id
).
value
=
val
.
join
(
','
);
console
.
log
(
this
.
conditionTypeList
);
},
storeChange
(
val
)
{
console
.
log
(
val
);
this
.
selectData
=
Object
.
assign
({},
this
.
selectData
);
},
onTabsClick
(
val
)
{
console
.
log
(
val
);
...
...
@@ -83,6 +93,39 @@ export default {
close
()
{
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
));
}
});
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
=
{
...
...
@@ -94,12 +137,21 @@ export default {
.
then
(
res
=>
{
let
resData
=
res
.
data
;
if
(
resData
.
errorCode
==
0
)
{
this
.
conditionTypeList
=
resData
.
result
;
this
.
activeName
=
this
.
conditionTypeList
.
length
&&
this
.
conditionTypeList
[
0
].
esScreeningWidgetChainId
;
this
.
conditionTypeList
.
forEach
(
item
=>
{
this
.
selectData
[
item
.
chainNodeName
]
=
[];
resData
.
result
.
forEach
(
item
=>
{
const
{
chainNodeName
,
templateCode
,
esScreeningWidgetChainId
,
columnKey
,
computeCharacter
,
dealKey
,
property
}
=
item
;
this
.
conditionTypeList
.
push
({
chainNodeName
,
templateCode
,
esScreeningWidgetChainId
,
columnKey
,
computeCharacter
,
dealKey
,
property
,
selectValue
:
[],
selectList
:
[]
});
});
this
.
activeName
=
this
.
conditionTypeList
.
length
&&
this
.
conditionTypeList
[
0
].
esScreeningWidgetChainId
;
this
.
getNode
(
this
.
activeName
);
return
;
}
...
...
@@ -116,26 +168,27 @@ export default {
});
},
getNode
(
widgetChainId
)
{
// 第二层节点的控件类型
this
.
axios
.
get
(
`/api-plug/get-screening-widget-chain-detail?requestProject=gic-web&widgetChainId=
${
widgetChainId
}
`
).
then
(
res
=>
{
const
{
esScreeningWidgetChainId
,
widget
:
{
sourceFlag
,
templateCode
,
widgetParam
,
widgetValues
},
widgetFieldKey
}
=
res
.
data
.
result
;
// 返回的结果 从第一层开始
this
.
templateCode
=
templateCode
;
console
.
log
(
res
.
data
.
result
);
if
(
sourceFlag
==
1
)
{
// 有接口
const
url
=
JSON
.
parse
(
widgetParam
)[
0
].
value
;
this
.
getChildNode
(
url
,
widgetFieldKey
);
this
.
getChildNode
(
url
,
widgetFieldKey
,
esScreeningWidgetChainId
);
}
else
{
if
(
templateCode
==
'tag001'
)
{
this
.
c
heckbox
List
=
JSON
.
parse
(
widgetValues
);
this
.
c
onditionTypeList
.
find
(
item
=>
item
.
esScreeningWidgetChainId
==
esScreeningWidgetChainId
).
select
List
=
JSON
.
parse
(
widgetValues
);
}
}
});
},
//
获取下一层控件
getChildNode
(
url
,
key
)
{
//
使用接口获取 第二层控件类型的内容
getChildNode
(
url
,
key
,
id
)
{
const
param
=
{
requestProject
:
'gic-web'
,
key
...
...
@@ -144,7 +197,7 @@ export default {
let
resData
=
res
.
data
;
console
.
log
(
resData
.
result
);
if
(
resData
.
errorCode
==
0
)
{
this
.
c
heckbox
List
=
resData
.
result
;
this
.
c
onditionTypeList
.
find
(
item
=>
item
.
esScreeningWidgetChainId
==
id
).
select
List
=
resData
.
result
;
}
});
}
...
...
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