Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-custom
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b4ffd1fa
authored
Mar 30, 2023
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
chatgpt
1 parent
eda0ab59
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
10 deletions
src/api/modules/crowdManage.js
src/views/crowdManage/crowdAdd.vue
src/api/modules/crowdManage.js
View file @
b4ffd1f
...
@@ -140,6 +140,17 @@ const activityPage = params => {
...
@@ -140,6 +140,17 @@ const activityPage = params => {
sign
:
true
sign
:
true
})
})
}
}
const
gpt
=
async
params
=>
{
const
response
=
await
fetch
(
'http://192.168.1.134:8090/ai/chat'
,
{
body
:
JSON
.
stringify
({
content
:
params
}),
headers
:
{
'content-type'
:
'application/json'
},
method
:
'POST'
})
return
response
.
json
()
// return new Http({ request: { timeout: 3000 } }).post('http://192.168.1.134:8090/ai/chat', { data: params })
}
export
default
{
export
default
{
getCrowdList
,
getCrowdList
,
getCrowdDetails
,
getCrowdDetails
,
...
@@ -152,5 +163,6 @@ export default {
...
@@ -152,5 +163,6 @@ export default {
editCrowdGroup
,
editCrowdGroup
,
deleteCrowdGroup
,
deleteCrowdGroup
,
queryCrowdGroupDetailsByCrowdGroupId
,
queryCrowdGroupDetailsByCrowdGroupId
,
activityPage
activityPage
,
gpt
}
}
src/views/crowdManage/crowdAdd.vue
View file @
b4ffd1f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"container"
id=
"container"
>
<div
class=
"container"
id=
"container"
>
<div>
<div>
<div
class=
"title"
>
创建人群
</div>
<div
class=
"title"
>
创建人群
</div>
<div
class=
"info-box"
>
<div
class=
"info-box"
>
<div
class=
"gl-form-page"
>
<div
class=
"gl-form-page"
>
<el-form
class=
"create-form"
:model=
"crowdForm"
:rules=
"crowdRules"
ref=
"crowdForm"
>
<el-form
class=
"create-form"
:model=
"crowdForm"
:rules=
"crowdRules"
ref=
"crowdForm"
>
<div
class=
"el-form-line"
>
<div
class=
"el-form-line"
>
...
@@ -27,6 +27,22 @@
...
@@ -27,6 +27,22 @@
</el-form-item>
</el-form-item>
</div>
</div>
</el-form>
</el-form>
<el-form
ref=
"orderform"
:model=
"orderform"
class=
"order-form"
>
<div
class=
"order"
>
<el-form-item
label=
"输入内容"
>
<el-input
type=
"textarea"
v-model=
"orderform.order"
rows=
"3"
:clearable=
"true"
></el-input>
</el-form-item>
<el-form-item>
<el-button
size=
"small"
@
click=
"handleResetOrder"
>
重置
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"handleOrder"
>
确定
</el-button>
</el-form-item>
</div>
<div
class=
"result"
>
<el-form-item
label=
"解析结果"
>
<el-input
type=
"textarea"
v-model=
"orderform.result"
rows=
"3"
></el-input>
</el-form-item>
</div>
</el-form>
</div>
</div>
<div
class=
"label-wrap"
>
<div
class=
"label-wrap"
>
<div
:class=
"
{ 'fixed-box': true, is_fixed: isFixed, is_pb: isDom }" id="boxFixed">
<div
:class=
"
{ 'fixed-box': true, is_fixed: isFixed, is_pb: isDom }" id="boxFixed">
...
@@ -99,7 +115,7 @@
...
@@ -99,7 +115,7 @@
<span
slot=
"labelUnitList"
slot-scope=
"scope"
>
<span
slot=
"labelUnitList"
slot-scope=
"scope"
>
<div
class=
"allTagsWrap flex"
>
<div
class=
"allTagsWrap flex"
>
<
template
v-for=
"(item, index) in scope.scope.labelUnitList"
>
<
template
v-for=
"(item, index) in scope.scope.labelUnitList"
>
<span
:class=
"['label', 'color-3', 'white-hide', 'mt10', item.checked ? 'isChecked' : '']"
:key=
"index
"
@
click=
"selectTag(item, index)"
>
<span
:class=
"['label', 'color-3', 'white-hide', 'mt10', item.checked ? 'isChecked' : '']"
v-if=
"true"
:key=
"`test_$
{index}`
" @click="selectTag(item, index)">
{{
item
.
labelName
}}
{{
item
.
labelName
}}
<template
v-if=
"item.checked"
>
<template
v-if=
"item.checked"
>
<img
src=
"@/assets/clientDetail/select-icon.png"
class=
"select-icon"
alt
/>
<img
src=
"@/assets/clientDetail/select-icon.png"
class=
"select-icon"
alt
/>
...
@@ -153,7 +169,7 @@
...
@@ -153,7 +169,7 @@
<div
class=
"crowd-logic-label-group-name font-14 color-3"
>
{{ logicTag.groupName }}:
</div>
<div
class=
"crowd-logic-label-group-name font-14 color-3"
>
{{ logicTag.groupName }}:
</div>
<div
class=
"flex"
>
<div
class=
"flex"
>
<
template
v-for=
"(tag, id) in logicTag.labelUnitList"
>
<
template
v-for=
"(tag, id) in logicTag.labelUnitList"
>
<div
class=
"crowd-logic-tag color-6 font-14"
:key=
"id"
>
{{
tag
.
labelName
}}
</div>
<div
class=
"crowd-logic-tag color-6 font-14"
v-if=
"true"
:key=
"id"
>
{{
tag
.
labelName
}}
</div>
<template
v-if=
"id
< logicTag
.
labelUnitList
.
length
-
1
"
>
<template
v-if=
"id
< logicTag
.
labelUnitList
.
length
-
1
"
>
<div
class=
"color-3 perhaps"
:key=
"id"
>
或
</div>
<div
class=
"color-3 perhaps"
:key=
"id"
>
或
</div>
</
template
>
</
template
>
...
@@ -182,6 +198,9 @@ export default {
...
@@ -182,6 +198,9 @@ export default {
isReload
:
true
,
isReload
:
true
,
dialogRuleVisible
:
false
,
dialogRuleVisible
:
false
,
dialogLogicVisible
:
false
,
dialogLogicVisible
:
false
,
orderform
:
{
order
:
''
},
crowdForm
:
{
crowdForm
:
{
crowdName
:
''
,
crowdName
:
''
,
crowdDesc
:
''
crowdDesc
:
''
...
@@ -242,6 +261,7 @@ export default {
...
@@ -242,6 +261,7 @@ export default {
this
.
getGroupList
()
this
.
getGroupList
()
//获取标签列表
//获取标签列表
this
.
getLabelList
()
this
.
getLabelList
()
// this.searchForm.labelName = '基盘客户'
//获取标签数据
//获取标签数据
this
.
getLabelData
()
this
.
getLabelData
()
},
},
...
@@ -459,17 +479,20 @@ export default {
...
@@ -459,17 +479,20 @@ export default {
'req.labelName'
:
this
.
searchForm
.
labelName
,
'req.labelName'
:
this
.
searchForm
.
labelName
,
...
this
.
page
...
this
.
page
}
}
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
$apis
.
crowdManage
.
getLabelTreeList
(
params
).
then
(
res
=>
{
this
.
$apis
.
crowdManage
.
getLabelTreeList
(
params
).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
res
.
data
.
groupUnitList
.
forEach
(
item
=>
{
;(
res
.
data
.
groupUnitList
||
[])
.
forEach
(
item
=>
{
item
.
labelUnitList
.
forEach
(
label
=>
{
item
.
labelUnitList
.
forEach
(
label
=>
{
label
.
checked
=
false
label
.
checked
=
false
})
})
})
})
this
.
tableData
=
res
.
data
.
groupUnitList
this
.
tableData
=
res
.
data
.
groupUnitList
||
[]
this
.
tableTotal
=
res
.
data
.
total
this
.
tableTotal
=
res
.
data
.
total
this
.
getHistoryLabel
()
this
.
getHistoryLabel
()
}
}
resolve
()
})
})
})
},
},
//已选择标签状态保存
//已选择标签状态保存
...
@@ -491,7 +514,6 @@ export default {
...
@@ -491,7 +514,6 @@ export default {
}
}
},
},
//选择标签
//选择标签
selectTag
(
data
)
{
selectTag
(
data
)
{
this
.
tableData
.
forEach
(
item
=>
{
this
.
tableData
.
forEach
(
item
=>
{
...
@@ -504,7 +526,6 @@ export default {
...
@@ -504,7 +526,6 @@ export default {
})
})
},
},
// 添加已选标签
// 添加已选标签
selectedLabelFn
(
groupData
,
data
)
{
selectedLabelFn
(
groupData
,
data
)
{
this
.
addClick
=
true
this
.
addClick
=
true
...
@@ -597,7 +618,7 @@ export default {
...
@@ -597,7 +618,7 @@ export default {
this
.
getLabelData
()
this
.
getLabelData
()
},
},
//重置表格
//重置表格
resetTable
()
{
async
resetTable
()
{
this
.
searchForm
=
{
this
.
searchForm
=
{
groupName
:
''
,
groupName
:
''
,
labelName
:
''
labelName
:
''
...
@@ -608,7 +629,7 @@ export default {
...
@@ -608,7 +629,7 @@ export default {
}
}
this
.
$refs
.
crowdManage
.
page
[
this
.
pageConf
.
pageSize
]
=
10
this
.
$refs
.
crowdManage
.
page
[
this
.
pageConf
.
pageSize
]
=
10
this
.
$refs
.
crowdManage
.
page
[
this
.
pageConf
.
pageNum
]
=
1
this
.
$refs
.
crowdManage
.
page
[
this
.
pageConf
.
pageNum
]
=
1
this
.
getLabelData
()
await
this
.
getLabelData
()
},
},
handleCancel
()
{
handleCancel
()
{
this
.
$router
.
push
(
`/crowdManage/index?selectTab=2`
)
this
.
$router
.
push
(
`/crowdManage/index?selectTab=2`
)
...
@@ -665,6 +686,79 @@ export default {
...
@@ -665,6 +686,79 @@ export default {
return
str
.
substr
(
0
,
subLen
)
return
str
.
substr
(
0
,
subLen
)
}
}
return
str
return
str
},
async
handleOrder
()
{
await
this
.
handleResetOrder
()
console
.
log
(
this
.
tableData
)
const
tagsAll
=
this
.
tableData
.
reduce
((
tags
,
next
)
=>
{
tags
+=
next
.
labelUnitList
.
map
(({
labelName
})
=>
labelName
).
join
(
','
)
return
tags
+
','
},
''
)
console
.
log
(
tagsAll
)
// 取值范围是:"${tagsAll}"输出json格式`
// 帮我创建一个人群名为测试群,描述为test,未加企微的客户。
// 帮我创建一个人群名为名车群,描述为名车车主群。去年和今年3月到4月间购车的奥迪和宝马车主。
// 帮我创建一个人群名为名车群,描述为名车车主群。去年和今年3月到4月间购车的奥迪和宝马有试驾的车主。
// 帮我创建一个人群名为名车群,描述为名车车主群。近两年购车的奥迪和宝马的30岁以下的有保养记录和试驾记录的男性车主。
//,取值范围:"'2020年','2021年','2022年','2023年','2000年','2001年','2002年','2003年'";
//,取值范围:"'1月','2月','3月','4月','5月','6月','7月','8月',9月,10月,11月,12月";
//,取值范围为:"'有','无'"
//取值范围为:"'30岁以下','31-40岁','41-55岁'",
// 提取出购车月份,命名为buyMonth,例如5月,用数组输出;
// tags包括上面的购车年份,命名为buyYear,购车月份,命名为buyMonth,车型,命名为brand,是否保养,命名为maintain
const
order
=
this
.
orderform
.
order
// const content = '帮我查询从2023-3-29日至2023-04-05日期间西安飞广州或者深圳的机票,从上面一句话中提取出发日期,命名为date,出发地,命名为start,目的地,命名为end,输出json格式。'
const
content
=
`
${
order
}
,忽略之前的提问,今年是2023年,针对上面这段文字,
提取出人群名称,命名为crowdName;
提取出人群描述,命名为crowdDesc;
提取出购车年份,命名为buyYear,例如20xx年,用数组输出;
提取品牌,命名为brand,用数组输出;
提取性别,命名为sex,用数组输出;
提取是否有保养记录,命名为maintain,用数组输出;
提取出年龄,命名为age,用数组输出;
提取出试驾记录,命名为drive,用数组输出;
所有提取字段取值范围是:"
${
tagsAll
}
"。
所有提取的字段未精确匹配到的不提取和输出。
输出json格式`
const
result
=
await
this
.
$apis
.
crowdManage
.
gpt
(
content
)
this
.
orderform
.
result
=
JSON
.
stringify
(
result
)
const
{
code
,
success
,
message
,
data
}
=
result
const
crowdName
=
data
.
crowdName
const
crowdDesc
=
data
.
crowdDesc
if
(
code
==
'000000'
&&
success
)
{
this
.
crowdForm
=
{
crowdName
,
crowdDesc
}
let
arr
=
[]
for
(
let
k
in
data
)
{
let
m
=
data
[
k
]
if
(
m
&&
m
!=
null
)
{
if
(
Array
.
isArray
(
m
))
{
arr
=
arr
.
concat
(
m
)
}
else
{
arr
.
push
(
m
)
}
}
}
console
.
log
(
arr
)
this
.
handleTags
(
arr
)
}
else
{
this
.
$message
.
error
(
message
)
}
},
handleTags
(
tags
=
[])
{
tags
.
forEach
(
async
tag
=>
{
this
.
searchForm
.
labelName
=
tag
await
this
.
getLabelData
()
if
(
this
.
tableData
?.
length
&&
this
.
tableData
[
0
].
labelUnitList
?.
length
)
{
this
.
selectTag
(
this
.
tableData
[
0
].
labelUnitList
[
0
])
}
})
},
async
handleResetOrder
()
{
this
.
crowdForm
=
{
crowdName
:
''
,
crowdDesc
:
''
}
this
.
selectedArray
=
[]
this
.
orderform
.
result
=
''
await
this
.
resetTable
()
}
}
},
},
destroyed
()
{
destroyed
()
{
...
@@ -893,6 +987,31 @@ export default {
...
@@ -893,6 +987,31 @@ export default {
}
}
}
}
}
}
.gl-form-page
{
position
:
relative
;
/deep/.order-form
{
position
:
absolute
;
top
:
-30px
;
right
:
300px
;
display
:
flex
;
justify-content
:
space-between
;
flex-direction
:
column
;
width
:
500px
;
.order
{
display
:
flex
;
align-items
:
end
;
.el-form-item
{
margin-bottom
:
0
!important
;
.el-button
{
margin-left
:
20px
;
}
}
}
.el-form-item__label
{
width
:
auto
!important
;
}
}
}
}
}
.footer-panel
{
.footer-panel
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment