Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-outbound
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 48f98cb9
authored
Oct 23, 2023
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交问卷需求
1 parent
e84b6249
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
140 additions
and
44 deletions
src/api/modules/questionnaire.js
src/mixins/getMerchantListMixin.js
src/views/questionnaire/components/DataTable/index.vue
src/views/questionnaire/components/StepOne/index.vue
src/views/questionnaire/components/StepTwo/EditQuestions.vue
src/views/questionnaire/index.vue
src/views/redEnvelope/components/RedEnvelopeConfig/index.vue
src/api/modules/questionnaire.js
View file @
48f98cb
...
@@ -34,6 +34,24 @@ export default {
...
@@ -34,6 +34,24 @@ export default {
data
:
params
data
:
params
})
})
},
},
/**
*导出调查问卷列表
*/
exportQuestionnaireList
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.export'
return
http
({
url
,
data
:
params
})
},
/**导出用户调查问卷 */
exportUserQuestionnaireList
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireUserForm.export'
return
http
({
url
,
data
:
params
})
},
/**新增调查问卷 */
/**新增调查问卷 */
addQuestionnaire
(
params
)
{
addQuestionnaire
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.add'
params
.
method
=
'marketing.api.activityQuestionnaireForm.add'
...
@@ -52,6 +70,16 @@ export default {
...
@@ -52,6 +70,16 @@ export default {
data
:
params
data
:
params
})
})
},
},
/**
*
*/
getQuestionnaireDetail
(
params
=
{})
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.detail'
return
http
({
url
,
data
:
params
})
},
/**权益卡试用 */
/**权益卡试用 */
getEquityActivityList
(
params
)
{
getEquityActivityList
(
params
)
{
params
.
method
=
'scrm.api.equity.open.card.price.list.by.merchantid'
params
.
method
=
'scrm.api.equity.open.card.price.list.by.merchantid'
...
...
src/mixins/getMerchantListMixin.js
View file @
48f98cb
...
@@ -11,6 +11,8 @@ export default {
...
@@ -11,6 +11,8 @@ export default {
}
}
}
}
},
},
mounted
()
{
},
methods
:
{
methods
:
{
selectFocus
()
{
selectFocus
()
{
const
{
configForm
}
=
this
const
{
configForm
}
=
this
...
@@ -61,7 +63,7 @@ export default {
...
@@ -61,7 +63,7 @@ export default {
inserted
(
el
,
binding
)
{
inserted
(
el
,
binding
)
{
const
SELECTWRAP_DOM
=
el
.
querySelector
(
'.el-select-dropdown .el-select-dropdown__wrap'
)
const
SELECTWRAP_DOM
=
el
.
querySelector
(
'.el-select-dropdown .el-select-dropdown__wrap'
)
SELECTWRAP_DOM
.
addEventListener
(
'scroll'
,
function
()
{
SELECTWRAP_DOM
.
addEventListener
(
'scroll'
,
function
()
{
const
condition
=
this
.
scrollHeight
-
this
.
scrollTop
<=
this
.
clientHeight
const
condition
=
(
this
.
scrollHeight
-
this
.
scrollTop
)
<=
this
.
clientHeight
if
(
condition
)
binding
.
value
()
if
(
condition
)
binding
.
value
()
})
})
}
}
...
...
src/views/questionnaire/components/DataTable/index.vue
View file @
48f98cb
...
@@ -6,12 +6,17 @@
...
@@ -6,12 +6,17 @@
:before-close=
"handleClose"
:before-close=
"handleClose"
:visible
.
sync=
"dataObj.show"
:visible
.
sync=
"dataObj.show"
>
>
<el-button
type=
"default"
@
click=
"handleExport"
>
导出
</el-button>
<GLTable
<GLTable
:tableData=
"tableData"
:tableData=
"tableData"
:noDataImg=
"url"
:noDataImg=
"url"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:tableTotal=
"tableTotal"
:tableTotal=
"tableTotal"
:pageConf=
"pageConf"
:pageConf=
"pageConf"
ref=
"listRef"
>
>
</GLTable>
</GLTable>
</GLDialog>
</GLDialog>
...
@@ -19,6 +24,7 @@
...
@@ -19,6 +24,7 @@
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
{
exportFn
}
from
'@/common/constant'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
props
:
{
props
:
{
...
@@ -34,7 +40,26 @@ export default {
...
@@ -34,7 +40,26 @@ export default {
tableParams
:
{
tableParams
:
{
listName
:
'data'
,
listName
:
'data'
,
tableOption
:
false
,
tableOption
:
false
,
tableColumns
:
[
tableColumns
:
[]
},
tableData
:
[],
tableTotal
:
0
}
},
mounted
()
{
},
watch
:
{
'dataObj'
(
n
)
{
if
(
n
.
id
)
{
this
.
setTableColumns
(
n
.
id
)
this
.
refreshTable
()
}
}
},
methods
:
{
async
setTableColumns
(
id
)
{
const
data
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetail
({
id
}),
tableColumns
=
[
{
{
label
:
'手机号码'
,
label
:
'手机号码'
,
prop
:
'phone'
,
prop
:
'phone'
,
...
@@ -51,20 +76,16 @@ export default {
...
@@ -51,20 +76,16 @@ export default {
minWidth
:
100
minWidth
:
100
},
},
]
]
data
.
questions
.
map
(
e
=>
{
tableColumns
.
push
({
label
:
e
.
text
,
prop
:
`
${
e
.
num
}
_prop`
,
minWidth
:
180
})
})
this
.
tableParams
.
tableColumns
=
tableColumns
console
.
log
(
data
)
},
},
tableData
:
[],
tableTotal
:
0
}
},
mounted
()
{
},
watch
:
{
'dataObj'
(
n
)
{
if
(
n
.
id
)
this
.
refreshTable
()
}
},
methods
:
{
async
refreshTable
(
pageCon
)
{
async
refreshTable
(
pageCon
)
{
pageCon
&&
(
this
.
pageConfig
=
pageCon
)
pageCon
&&
(
this
.
pageConfig
=
pageCon
)
const
{
id
}
=
this
.
dataObj
,
const
{
id
}
=
this
.
dataObj
,
...
@@ -75,20 +96,30 @@ export default {
...
@@ -75,20 +96,30 @@ export default {
...
this
.
pageConfig
...
this
.
pageConfig
}
}
const
{
data
,
count
}
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetailPage
(
params
)
const
{
data
,
count
}
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetailPage
(
params
)
data
.
map
(
e
=>
{
e
.
questions
.
map
(
i
=>
{
e
[
`
${
i
.
num
}
_prop`
]
=
i
.
answer
})
})
this
.
tableData
=
data
||
[]
this
.
tableData
=
data
||
[]
this
.
tableTotal
=
count
||
0
this
.
tableTotal
=
count
||
0
},
},
handleClose
()
{
handleClose
()
{
this
.
$emit
(
'update:dataObj'
,
{})
this
.
$emit
(
'update:dataObj'
,
{})
},
},
handleExport
()
{
const
{
id
}
=
this
.
dataObj
this
.
$apis
.
questionnaire
.
exportUserQuestionnaireList
({
formId
:
id
,
...
this
.
$refs
.
listRef
.
page
}).
then
(
res
=>
{
exportFn
(
res
)
})
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
'scss'
>
<
style
scoped
lang=
'scss'
>
.link
{
.el-button
{
/deep/.el-form-item--small
{
display
:
flex
;
width
:
fit-content
;
margin
:
0
0
8px
auto
;
}
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/index.vue
View file @
48f98cb
...
@@ -190,13 +190,13 @@ export default {
...
@@ -190,13 +190,13 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
this
.
onReachBottom
(
this
)
this
.
on
Activity
ReachBottom
(
this
)
},
},
methods
:
{
methods
:
{
formRef
()
{
formRef
()
{
return
this
.
$refs
.
formRef
.
$refs
.
formRef
return
this
.
$refs
.
formRef
.
$refs
.
formRef
},
},
onReachBottom
(
_this
)
{
on
Activity
ReachBottom
(
_this
)
{
this
.
$refs
.
stepBox
.
wrap
.
addEventListener
(
'scroll'
,
function
()
{
this
.
$refs
.
stepBox
.
wrap
.
addEventListener
(
'scroll'
,
function
()
{
const
condition
=
this
.
scrollHeight
-
this
.
scrollTop
-
20
<=
this
.
clientHeight
,
const
condition
=
this
.
scrollHeight
-
this
.
scrollTop
-
20
<=
this
.
clientHeight
,
{
index
}
=
_this
.
tabsObj
,
{
index
}
=
_this
.
tabsObj
,
...
@@ -214,7 +214,7 @@ export default {
...
@@ -214,7 +214,7 @@ export default {
changeActivity
(
index
)
{
changeActivity
(
index
)
{
const
{
merchantId
}
=
this
.
configForm
const
{
merchantId
}
=
this
.
configForm
if
(
this
.
tabsObj
.
index
==
index
)
return
if
(
this
.
tabsObj
.
index
==
index
)
return
if
(
!
merchantId
)
return
this
.
$message
.
error
(
'请
先
选择所属渠道'
)
if
(
!
merchantId
)
return
this
.
$message
.
error
(
'请选择所属渠道'
)
this
.
tabsObj
.
index
=
index
this
.
tabsObj
.
index
=
index
this
.
configForm
.
activityId
=
''
this
.
configForm
.
activityId
=
''
this
.
configForm
.
activityType
=
''
this
.
configForm
.
activityType
=
''
...
...
src/views/questionnaire/components/StepTwo/EditQuestions.vue
View file @
48f98cb
...
@@ -257,11 +257,16 @@ export default {
...
@@ -257,11 +257,16 @@ export default {
close
()
{
close
()
{
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
$refs
.
configRef
.
resetFields
()
this
.
$refs
.
configRef
.
resetFields
()
this
.
errorList
=
[]
this
.
$emit
(
'update:show'
,
false
)
this
.
$emit
(
'update:show'
,
false
)
},
},
handleFileUpload
(
event
)
{
handleFileUpload
(
event
)
{
const
[
file
]
=
event
.
target
.
files
const
[
file
]
=
event
.
target
.
files
if
(
file
)
{
if
(
file
)
{
if
(
this
.
configForm
.
cascaderValue
.
length
)
{
this
.
$refs
.
file
.
value
=
''
return
this
.
$message
.
error
(
'已有数据,不能批量导入!'
)
}
const
reader
=
new
FileReader
()
const
reader
=
new
FileReader
()
reader
.
onload
=
e
=>
{
reader
.
onload
=
e
=>
{
try
{
try
{
...
@@ -272,27 +277,41 @@ export default {
...
@@ -272,27 +277,41 @@ export default {
[
firstSheetName
]
=
workbook
.
SheetNames
,
[
firstSheetName
]
=
workbook
.
SheetNames
,
worksheet
=
workbook
.
Sheets
[
firstSheetName
],
worksheet
=
workbook
.
Sheets
[
firstSheetName
],
parsedData
=
XLSX
.
utils
.
sheet_to_json
(
worksheet
,
{
header
:
1
}),
parsedData
=
XLSX
.
utils
.
sheet_to_json
(
worksheet
,
{
header
:
1
}),
errorList
=
[]
formattedData
=
[]
let
str
=
''
parsedData
.
map
(
i
=>
{
parsedData
.
map
((
i
,
rowNum
)
=>
{
const
[
row
]
=
i
let
[
row
]
=
i
if
(
row
)
{
if
(
row
)
{
const
[
one
,
two
,
three
]
=
row
.
split
(
'/'
)
const
[
one
,
two
,
three
]
=
String
(
row
).
split
(
'/'
)
if
(
!
one
||
!
two
)
errorList
.
push
(
`第
${
rowNum
+
1
}
行第
${
one
?
'2'
:
'1'
}
列数据异常,请重新输入`
)
formattedData
.
push
(
`
${
one
||
''
}
/
${
two
||
''
}${
three
?
`/
${
three
}
`
:
''
}
`
)
str
+=
`
${
one
||
''
}
/
${
two
||
''
}
/
${
three
||
''
}${
rowNum
==
parsedData
.
length
-
1
?
''
:
'\n'
}
`
}
}
})
})
this
.
configForm
.
cascaderValue
=
str
this
.
configForm
.
cascaderValue
=
formattedData
.
join
(
'\n'
)
this
.
errorList
=
errorList
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
}
else
throw
'数据不能为空'
}
else
throw
'数据不能为空'
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
this
.
$message
.
error
(
error
||
'读取文件时出错'
)
this
.
$message
.
error
(
error
||
'读取文件时出错'
)
}
}
}
}
reader
.
readAsArrayBuffer
(
file
)
reader
.
readAsArrayBuffer
(
file
)
}
}
},
},
checkData
(
data
)
{
const
errorList
=
[],
list
=
data
.
split
(
'\n'
),
[,
,
hasThree
]
=
list
[
0
].
split
(
'/'
)
list
.
forEach
((
row
,
rowNum
)
=>
{
if
(
rowNum
!=
0
)
{
const
[
one
,
two
]
=
String
(
row
).
split
(
'/'
)
if
(
hasThree
)
{
if
(
!
one
||
!
two
)
errorList
.
push
(
`第
${
rowNum
+
1
}
行第
${(
one
?
'2'
:
'1'
)}
列数据异常,请重新输入`
)
}
else
if
(
!
one
)
errorList
.
push
(
`第
${
rowNum
+
1
}
行第1列数据异常,请重新输入`
)
}
})
if
(
errorList
.
length
)
this
.
errorList
=
[
errorList
[
0
]]
return
errorList
.
length
},
delError
(
index
)
{
delError
(
index
)
{
this
.
errorList
.
splice
(
index
,
1
)
this
.
errorList
.
splice
(
index
,
1
)
},
},
...
@@ -313,14 +332,18 @@ export default {
...
@@ -313,14 +332,18 @@ export default {
{
userInfoFields
}
=
this
{
userInfoFields
}
=
this
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
errorList
=
[]
let
option
=
this
.
configForm
[
inputKeyObject
[
type
]],
let
option
=
this
.
configForm
[
inputKeyObject
[
type
]],
data
=
type
==
3
?
option
:
option
.
split
(
'\n'
),
data
=
type
==
3
?
option
:
option
.
split
(
'\n'
),
itemValue
=
''
itemValue
=
''
if
(
type
==
2
||
type
==
5
)
itemValue
=
[]
if
(
type
==
2
||
type
==
5
)
itemValue
=
[]
if
(
type
==
5
)
{
if
(
type
==
5
)
{
data
.
splice
(
0
,
1
)
if
(
data
.
length
<
2
)
return
this
.
$message
.
error
(
'数据不能为空'
)
const
[,
two
,
three
]
=
data
[
0
].
split
(
'/'
)
option
=
data
.
join
(
'\n'
)
option
=
data
.
join
(
'\n'
)
data
=
this
.
transformData
(
data
)
if
(
this
.
checkData
(
option
))
return
data
.
splice
(
0
,
1
)
data
=
this
.
transformData
(
data
,
three
?
3
:
two
?
2
:
1
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
}
}
this
.
$emit
(
'addQuestions'
,
{
this
.
$emit
(
'addQuestions'
,
{
...
@@ -336,25 +359,24 @@ export default {
...
@@ -336,25 +359,24 @@ export default {
}
}
})
})
},
},
transformData
(
data
)
{
transformData
(
data
,
childrenDepth
)
{
const
result
=
[]
const
result
=
[]
data
.
forEach
(
(
item
,
index
)
=>
{
data
.
forEach
(
item
=>
{
const
levels
=
item
.
split
(
'/'
)
const
levels
=
item
.
split
(
'/'
)
let
currentLevel
=
result
let
currentLevel
=
result
for
(
let
i
=
0
;
i
<
levels
.
leng
th
;
i
++
)
{
for
(
let
i
=
0
;
i
<
childrenDep
th
;
i
++
)
{
const
label
=
levels
[
i
],
const
label
=
levels
[
i
],
value
=
label
,
value
=
label
,
existingOption
=
currentLevel
.
find
((
option
)
=>
option
.
label
===
label
)
existingOption
=
currentLevel
.
find
((
option
)
=>
option
.
label
===
label
)
if
(
existingOption
)
{
if
(
existingOption
)
{
if
(
i
===
levels
.
leng
th
-
1
)
{
if
(
i
===
childrenDep
th
-
1
)
{
continue
continue
}
}
currentLevel
=
existingOption
.
children
currentLevel
=
existingOption
.
children
}
else
{
}
else
{
const
newOption
=
{
label
,
value
,
children
:
[]
}
const
newOption
=
{
label
,
value
,
children
:
[]
}
currentLevel
.
push
(
newOption
)
if
(
label
&&
value
)
currentLevel
.
push
(
newOption
)
if
(
i
===
childrenDepth
-
1
)
{
if
(
i
===
levels
.
length
-
1
)
{
delete
newOption
.
children
delete
newOption
.
children
}
}
currentLevel
=
newOption
.
children
currentLevel
=
newOption
.
children
...
...
src/views/questionnaire/index.vue
View file @
48f98cb
...
@@ -18,6 +18,10 @@
...
@@ -18,6 +18,10 @@
path: '/questionnaire/add'
path: '/questionnaire/add'
})"
})"
>新建问卷
</el-button>
>新建问卷
</el-button>
<el-button
type=
"default"
@
click=
"handleExport"
>
导出
</el-button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -86,13 +90,14 @@
...
@@ -86,13 +90,14 @@
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
DataTable
from
'./components/DataTable/index.vue'
import
DataTable
from
'./components/DataTable/index.vue'
import
{
exportFn
}
from
'@/common/constant'
export
default
{
export
default
{
name
:
'
RedEnvelopeConfig
'
,
name
:
'
Questionnaire
'
,
components
:
{
DataTable
},
components
:
{
DataTable
},
data
()
{
data
()
{
return
{
return
{
url
,
url
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'
total
'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'
count
'
},
searchForm
:
{
searchForm
:
{
merchantName
:
''
,
merchantName
:
''
,
name
:
''
,
name
:
''
,
...
@@ -200,6 +205,11 @@ export default {
...
@@ -200,6 +205,11 @@ export default {
this
.
handleSearch
()
this
.
handleSearch
()
}
else
this
.
$message
.
error
(
'操作失败,请重试。'
)
}
else
this
.
$message
.
error
(
'操作失败,请重试。'
)
},
},
handleExport
()
{
this
.
$apis
.
questionnaire
.
exportQuestionnaireList
({
...
this
.
searchForm
,
...
this
.
$refs
.
listRef
.
page
}).
then
(
res
=>
{
exportFn
(
res
)
})
}
}
}
}
}
</
script
>
</
script
>
...
...
src/views/redEnvelope/components/RedEnvelopeConfig/index.vue
View file @
48f98cb
...
@@ -211,8 +211,11 @@ export default {
...
@@ -211,8 +211,11 @@ export default {
id
:
e
.
id
||
''
id
:
e
.
id
||
''
}
}
},
},
handleExport
(
row
)
{
handleExport
()
{
this
.
$apis
.
redenvelope
.
exportActivityRedEnvelope
(
this
.
getParams
()).
then
(
res
=>
{
this
.
$apis
.
redenvelope
.
exportActivityRedEnvelope
({
...
this
.
getParams
(),
...
this
.
$refs
.
listRef
.
page
}).
then
(
res
=>
{
exportFn
(
res
)
exportFn
(
res
)
})
})
},
},
...
...
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