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 2b3cf4f1
authored
Nov 06, 2023
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
月底需求
1 parent
23137f42
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
406 additions
and
77 deletions
src/api/modules/questionnaire.js
src/assets/css/public.scss
src/views/questionnaire/add.vue
src/views/questionnaire/components/StepOne/CouponItem.vue
src/views/questionnaire/components/StepOne/EquityItem.vue
src/views/questionnaire/components/StepOne/RedEnvelopeItem.vue
src/views/questionnaire/components/StepOne/index.vue
src/views/questionnaire/components/StepTwo/EditQuestions.vue
src/views/questionnaire/components/StepTwo/index.vue
src/views/questionnaire/index.vue
src/api/modules/questionnaire.js
View file @
2b3cf4f
...
@@ -45,7 +45,7 @@ export default {
...
@@ -45,7 +45,7 @@ export default {
})
})
},
},
/**导出用户调查问卷 */
/**导出用户调查问卷 */
exportUserQuestionnaireList
(
params
)
{
exportUserQuestionnaireList
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireUserForm.export'
params
.
method
=
'marketing.api.activityQuestionnaireUserForm.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -71,7 +71,7 @@ export default {
...
@@ -71,7 +71,7 @@ export default {
})
})
},
},
/**
/**
*
*
查询调查问卷详情
*/
*/
getQuestionnaireDetail
(
params
=
{})
{
getQuestionnaireDetail
(
params
=
{})
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.detail'
params
.
method
=
'marketing.api.activityQuestionnaireForm.detail'
...
...
src/assets/css/public.scss
View file @
2b3cf4f
...
@@ -118,3 +118,21 @@ img{
...
@@ -118,3 +118,21 @@ img{
width
:
auto
!
important
;
width
:
auto
!
important
;
height
:
auto
!
important
;
height
:
auto
!
important
;
}
}
.over-box
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
height
:
100%
;
font-size
:
16px
;
color
:
#333333
;
gap
:
8px
;
.el-icon-warning
{
font-size
:
48px
;
color
:
#e6a23c
;
}
.tips
{
font-size
:
14px
;
color
:
#666666
;
}
}
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/add.vue
View file @
2b3cf4f
<
template
>
<
template
>
<div
class=
"layout"
v-loading=
"loading"
>
<div
class=
"layout"
v-loading=
"loading"
>
<div
class=
"tabs flex"
>
<div
class=
"tabs flex"
>
<template
v-for=
"(i,index) in tabs"
>
<template
v-for=
"(i,index) in tabs"
>
<template>
<template>
...
@@ -27,10 +30,12 @@
...
@@ -27,10 +30,12 @@
<step-one
<step-one
v-show=
"step == 1"
v-show=
"step == 1"
ref=
"stepOne"
ref=
"stepOne"
:readonly=
"readonly"
/>
/>
<step-two
<step-two
v-show=
"step == 2"
v-show=
"step == 2"
ref=
"stepTwo"
ref=
"stepTwo"
:readonly=
"readonly"
/>
/>
</div>
</div>
<GLFooter
class=
"footer"
>
<GLFooter
class=
"footer"
>
...
@@ -56,14 +61,61 @@ export default {
...
@@ -56,14 +61,61 @@ export default {
data
()
{
data
()
{
return
{
return
{
parsedData
:
[],
parsedData
:
[],
step
:
1
,
step
:
2
,
tabs
:
[
'基本信息'
,
'配置内容'
],
tabs
:
[
'基本信息'
,
'配置内容'
],
loading
:
false
loading
:
false
,
readonly
:
false
,
fromId
:
''
}
}
},
},
mounted
()
{
mounted
()
{
const
{
id
,
type
}
=
this
.
$route
.
query
if
(
id
)
{
this
.
fromId
=
id
this
.
readonly
=
!
type
this
.
getQuestionnaireDetail
()
}
},
},
methods
:
{
methods
:
{
async
getQuestionnaireDetail
()
{
const
data
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetail
({
id
:
this
.
fromId
}),
{
$refs
:
{
stepOne
,
stepTwo
}
}
=
this
this
.
setStepOneData
(
stepOne
,
data
)
this
.
setStepTwoData
(
stepTwo
,
data
)
console
.
log
(
data
)
},
setStepOneData
(
stepOne
,
data
)
{
stepOne
.
merchantObj
.
data
=
[{
confId
:
data
.
merchantId
,
confName
:
data
.
merchantName
}]
stepOne
.
configForm
=
{
name
:
data
.
name
,
merchantId
:
data
.
merchantId
,
cardTitle
:
data
.
cardTitle
,
cardCover
:
data
.
cardCover
,
activityId
:
data
.
activityId
,
merchantName
:
data
.
merchantName
,
activityType
:
data
.
activityType
}
if
(
data
.
activityType
)
{
stepOne
.
tabsObj
.
index
=
{
1
:
0
,
2
:
2
,
3
:
3
}[
data
.
activityType
]
}
if
(
!
this
.
readonly
||
data
.
activityId
)
stepOne
.
getActivityList
()
},
setStepTwoData
(
stepTwo
,
data
)
{
stepTwo
.
configForm
=
data
},
handleCancel
()
{
handleCancel
()
{
const
{
step
}
=
this
const
{
step
}
=
this
step
==
1
?
this
.
$router
.
go
(
-
1
)
:
this
.
step
=
1
step
==
1
?
this
.
$router
.
go
(
-
1
)
:
this
.
step
=
1
...
@@ -85,7 +137,7 @@ export default {
...
@@ -85,7 +137,7 @@ export default {
const
params
=
{
const
params
=
{
...
stepOne
.
configForm
,
...
stepOne
.
configForm
,
...
stepTwo
.
configForm
,
...
stepTwo
.
configForm
,
status
:
1
status
:
0
},
res
=
await
this
.
$apis
.
questionnaire
.
addQuestionnaire
(
params
)
},
res
=
await
this
.
$apis
.
questionnaire
.
addQuestionnaire
(
params
)
console
.
log
(
res
)
console
.
log
(
res
)
if
(
res
)
{
if
(
res
)
{
...
...
src/views/questionnaire/components/StepOne/CouponItem.vue
View file @
2b3cf4f
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.id)"
@
click=
"chooseRed(data.id)"
:class=
"['item',
{'active':configForm.activityId == data.id}]"
:class=
"['item',
{'
disabled':readonly},{'
active':configForm.activityId == data.id}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -38,7 +38,8 @@ export default {
...
@@ -38,7 +38,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
},
readonly
:
Boolean
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -49,8 +50,10 @@ export default {
...
@@ -49,8 +50,10 @@ export default {
},
},
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
readonly
}
=
this
if
(
readonly
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -105,4 +108,7 @@ export default {
...
@@ -105,4 +108,7 @@ export default {
background-color
:
#5850ff
;
background-color
:
#5850ff
;
}
}
}
}
.disabled
{
cursor
:
not-allowed
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/EquityItem.vue
View file @
2b3cf4f
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.equityClassId)"
@
click=
"chooseRed(data.equityClassId)"
:class=
"['item',
{'active':configForm.activityId == data.equityClassId}]"
:class=
"['item',
{'
disabled':readonly},{'
active':configForm.activityId == data.equityClassId}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -25,7 +25,8 @@ export default {
...
@@ -25,7 +25,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
},
readonly
:
Boolean
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -36,8 +37,10 @@ export default {
...
@@ -36,8 +37,10 @@ export default {
},
},
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
readonly
}
=
this
if
(
readonly
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -98,4 +101,7 @@ export default {
...
@@ -98,4 +101,7 @@ export default {
background-color
:
#5850ff
;
background-color
:
#5850ff
;
}
}
}
}
.disabled
{
cursor
:
not-allowed
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/RedEnvelopeItem.vue
View file @
2b3cf4f
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.id)"
@
click=
"chooseRed(data.id)"
:class=
"['item',
{'active':configForm.activityId == data.id}]"
:class=
"['item',
{'
disabled':readonly},{'
active':configForm.activityId == data.id}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -26,7 +26,8 @@ export default {
...
@@ -26,7 +26,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
}
,
readonly
:
Boolean
}
,
}
,
data
()
{
data
()
{
return
{
return
{
...
@@ -37,8 +38,10 @@ export default {
...
@@ -37,8 +38,10 @@ export default {
}
,
}
,
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
readonly
}
=
this
if
(
readonly
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -88,4 +91,7 @@ export default {
...
@@ -88,4 +91,7 @@ export default {
background
-
color
:
#
5850
ff
;
background
-
color
:
#
5850
ff
;
}
}
}
}
.
disabled
{
cursor
:
not
-
allowed
;
}
<
/style>
<
/style>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/index.vue
View file @
2b3cf4f
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
v-reachbottom=
"onReachBottom"
v-reachbottom=
"onReachBottom"
@
focus=
"selectFocus"
@
focus=
"selectFocus"
:loading=
"loading"
:loading=
"loading"
:disabled=
"readonly"
@
change=
"change"
>
>
<el-option
<el-option
v-for=
"item in merchantObj.data"
v-for=
"item in merchantObj.data"
...
@@ -44,7 +46,7 @@
...
@@ -44,7 +46,7 @@
@
click=
"changeActivity(index)"
@
click=
"changeActivity(index)"
:class=
"['tab',
{active:index == tabsObj.index}]"
:class=
"['tab',
{active:index == tabsObj.index}]"
:key="index"
:key="index"
:disabled="index == 1"
:disabled="index == 1
|| readonly
"
>
{{
i
}}
</el-button>
>
{{
i
}}
</el-button>
</
template
>
</
template
>
</template>
</template>
...
@@ -66,6 +68,7 @@
...
@@ -66,6 +68,7 @@
}[tabsObj.index]"
}[tabsObj.index]"
:configForm="configForm"
:configForm="configForm"
:data="i"
:data="i"
:readonly="readonly"
@choose="choose"
@choose="choose"
>
</component>
>
</component>
</
template
>
</
template
>
...
@@ -95,11 +98,13 @@ import { getMerchantListMixin } from '@/mixins'
...
@@ -95,11 +98,13 @@ import { getMerchantListMixin } from '@/mixins'
import
EquityItem
from
'./EquityItem.vue'
import
EquityItem
from
'./EquityItem.vue'
import
CouponItem
from
'./CouponItem.vue'
import
CouponItem
from
'./CouponItem.vue'
import
RedEnvelopeItem
from
'./RedEnvelopeItem.vue'
import
RedEnvelopeItem
from
'./RedEnvelopeItem.vue'
// import CombiForm from '@/components/glsx-combi-form/index.vue'
export
default
{
export
default
{
name
:
'StepOne'
,
name
:
'StepOne'
,
mixins
:
[
getMerchantListMixin
],
mixins
:
[
getMerchantListMixin
],
components
:
{
RedEnvelopeItem
,
EquityItem
,
CouponItem
},
components
:
{
RedEnvelopeItem
,
EquityItem
,
CouponItem
},
props
:
{
readonly
:
Boolean
},
data
()
{
data
()
{
return
{
return
{
configForm
:
{
configForm
:
{
...
@@ -188,14 +193,10 @@ export default {
...
@@ -188,14 +193,10 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
'configForm.merchantId'
(
n
)
{
'readonly'
(
n
)
{
if
(
n
)
{
this
.
formData
.
map
(
e
=>
{
this
.
configForm
.
activityId
=
''
e
.
isDisabled
=
n
this
.
configForm
.
activityType
=
''
})
this
.
configForm
.
merchantName
=
this
.
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
n
).
confName
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
this
.
getActivityList
()
}
else
this
.
activityObj
.
data
=
[]
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -203,6 +204,13 @@ export default {
...
@@ -203,6 +204,13 @@ export default {
this
.
activityObj
.
flag
=
true
this
.
activityObj
.
flag
=
true
},
},
methods
:
{
methods
:
{
change
(
id
)
{
this
.
configForm
.
activityId
=
''
this
.
configForm
.
activityType
=
''
this
.
configForm
.
merchantName
=
this
.
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
id
).
confName
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
this
.
getActivityList
()
},
formRef
()
{
formRef
()
{
return
this
.
$refs
.
formRef
.
$refs
.
formRef
return
this
.
$refs
.
formRef
.
$refs
.
formRef
},
},
...
@@ -226,7 +234,7 @@ export default {
...
@@ -226,7 +234,7 @@ export default {
})
})
},
},
changeActivity
(
index
)
{
changeActivity
(
index
)
{
const
{
merchantId
}
=
this
.
configForm
const
{
merchantId
,
id
}
=
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
...
@@ -271,6 +279,8 @@ export default {
...
@@ -271,6 +279,8 @@ export default {
const
{
index
}
=
this
.
tabsObj
const
{
index
}
=
this
.
tabsObj
this
.
configForm
.
activityId
=
e
this
.
configForm
.
activityId
=
e
this
.
configForm
.
activityType
=
e
?
index
==
0
?
1
:
index
:
''
this
.
configForm
.
activityType
=
e
?
index
==
0
?
1
:
index
:
''
console
.
log
(
this
.
configForm
)
}
}
},
},
...
...
src/views/questionnaire/components/StepTwo/EditQuestions.vue
View file @
2b3cf4f
<
template
>
<
template
>
<el-drawer
<el-drawer
:visible
.
sync=
"show"
:visible
.
sync=
"
editQuestionsObj.
show"
direction=
"rtl"
direction=
"rtl"
size=
"880px"
size=
"880px"
:before-close=
"close"
:before-close=
"close"
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
<el-radio
<el-radio
:key=
"index"
:key=
"index"
:label=
"i.value"
:label=
"i.value"
@
change=
"changeType"
:disabled=
"editQuestionsObj.data && configForm.type != i.value"
>
{{
i
.
label
}}
</el-radio>
>
{{
i
.
label
}}
</el-radio>
</
template
>
</
template
>
</template>
</template>
...
@@ -218,7 +220,10 @@ const inputKeyObject = {
...
@@ -218,7 +220,10 @@ const inputKeyObject = {
}
}
export
default
{
export
default
{
props
:
{
props
:
{
show
:
Boolean
,
editQuestionsObj
:
{
type
:
Object
,
default
:
()
=>
{
}
},
userInfoFieldList
:
{
userInfoFieldList
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[]
default
:
()
=>
[]
...
@@ -266,18 +271,45 @@ export default {
...
@@ -266,18 +271,45 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
'configForm.type'
()
{
'editQuestionsObj'
(
n
)
{
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
if
(
n
.
data
)
{
const
{
data
,
data
:
{
type
,
userInfoField
}
}
=
n
this
.
configForm
=
{
type
,
required
:
data
.
required
,
text
:
data
.
text
,
userInfoField
:
''
,
value
:
''
,
maxLength
:
1
,
radioValue
:
''
,
checkboxValue
:
''
,
selectValue
:
''
,
cascaderValue
:
''
}
if
(
type
!=
3
)
{
this
.
configForm
[
inputKeyObject
[
type
]]
=
String
(
data
.
option
)
if
(
userInfoField
)
{
if
(
type
==
5
)
this
.
userInfoFields
=
userInfoField
.
split
(
'/'
).
map
(
e
=>
Number
(
e
))
else
this
.
configForm
.
userInfoField
=
Number
(
userInfoField
)
}
}
else
this
.
configForm
.
maxLength
=
data
.
option
}
}
}
},
},
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
changeType
()
{
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
},
close
()
{
close
()
{
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
userInfoFields
=
this
.
$options
.
data
.
call
(
this
).
userInfoFields
this
.
$refs
.
configRef
.
resetFields
()
this
.
$refs
.
configRef
.
resetFields
()
this
.
errorList
=
[]
this
.
errorList
=
[]
this
.
$emit
(
'update:show'
,
false
)
this
.
$emit
(
'update:editQuestionsObj'
,
{
show
:
false
})
},
},
handleFileUpload
(
event
)
{
handleFileUpload
(
event
)
{
const
[
file
]
=
event
.
target
.
files
const
[
file
]
=
event
.
target
.
files
...
@@ -348,16 +380,15 @@ export default {
...
@@ -348,16 +380,15 @@ export default {
},
},
handleConfirm
()
{
handleConfirm
()
{
let
{
type
,
required
,
text
,
userInfoField
}
=
this
.
configForm
,
let
{
type
,
required
,
text
,
userInfoField
}
=
this
.
configForm
,
{
userInfoFields
}
=
this
{
userInfoFields
}
=
this
,
{
index
}
=
this
.
editQuestionsObj
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
try
{
try
{
this
.
errorList
=
[]
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
=
''
if
(
type
!=
3
)
{
if
(
type
!=
3
)
{
if
(
type
==
2
||
type
==
5
)
itemValue
=
[]
if
(
type
==
5
)
{
if
(
type
==
5
)
{
const
title
=
data
[
0
].
split
(
'/'
)
const
title
=
data
[
0
].
split
(
'/'
)
if
(
data
.
length
<
2
)
throw
'数据不能为空'
if
(
data
.
length
<
2
)
throw
'数据不能为空'
...
@@ -368,7 +399,6 @@ export default {
...
@@ -368,7 +399,6 @@ export default {
data
=
this
.
transformData
(
data
,
three
?
3
:
two
?
2
:
1
)
data
=
this
.
transformData
(
data
,
three
?
3
:
two
?
2
:
1
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
}
}
// else data = Array.from(new Set([...data.map(e => e)]))
}
}
this
.
$emit
(
'addQuestions'
,
{
this
.
$emit
(
'addQuestions'
,
{
type
,
type
,
...
@@ -376,9 +406,8 @@ export default {
...
@@ -376,9 +406,8 @@ export default {
text
,
text
,
userInfoField
,
userInfoField
,
data
,
data
,
option
,
option
itemValue
},
index
)
})
this
.
close
()
this
.
close
()
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
...
src/views/questionnaire/components/StepTwo/index.vue
View file @
2b3cf4f
...
@@ -109,23 +109,52 @@
...
@@ -109,23 +109,52 @@
style=
"width:432px;"
style=
"width:432px;"
></el-cascader>
></el-cascader>
</
template
>
</
template
>
<div
class=
"control-box"
>
<
template
v-for=
"(c,ind) in controlOptions"
>
<template>
<el-button
:key=
"ind"
type=
"text"
@
click=
"controlClick(index,ind)"
:disabled=
"controlDisabled(index,ind)"
>
{{
c
}}
</el-button>
</
template
>
</template>
</div>
</div>
</div>
</template>
</template>
</template>
</template>
<el-button
<el-button
icon=
"el-icon-plus"
icon=
"el-icon-plus"
size=
"small"
size=
"small"
@
click=
"
showEditQuestions
= true"
@
click=
"
editQuestionsObj.show
= true"
>
添加题目
</el-button>
>
添加题目
</el-button>
</div>
</div>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
<edit-questions
<edit-questions
:
show
.
sync=
"showEditQuestions
"
:
editQuestionsObj
.
sync=
"editQuestionsObj
"
@
addQuestions=
"addQuestions"
@
addQuestions=
"addQuestions"
:userInfoFieldList=
"userInfoFieldList"
:userInfoFieldList=
"userInfoFieldList"
/>
/>
<GLDialog
title=
"删除"
@
onOk=
"delItem"
@
onCancel=
"delObj.show = false"
:visible
.
sync=
"delObj.show"
mode=
"small"
>
<
template
#
default
>
<div
class=
"over-box"
>
<div
class=
"el-icon-warning"
></div>
请确认是否删除以下题目?
<div
class=
"tips"
>
题目名称:
{{
delObj
.
text
}}
</div>
</div>
</
template
>
</GLDialog>
</el-scrollbar>
</el-scrollbar>
</template>
</template>
...
@@ -134,6 +163,9 @@ import EditQuestions from './EditQuestions.vue'
...
@@ -134,6 +163,9 @@ import EditQuestions from './EditQuestions.vue'
export
default
{
export
default
{
name
:
'StepTwo'
,
name
:
'StepTwo'
,
components
:
{
EditQuestions
},
components
:
{
EditQuestions
},
props
:
{
readonly
:
Boolean
},
data
()
{
data
()
{
return
{
return
{
configForm
:
{
configForm
:
{
...
@@ -146,15 +178,36 @@ export default {
...
@@ -146,15 +178,36 @@ export default {
desc
:
[{
required
:
true
,
message
:
'请输入问卷说明'
,
trigger
:
'change'
}],
desc
:
[{
required
:
true
,
message
:
'请输入问卷说明'
,
trigger
:
'change'
}],
questions
:
[{
required
:
true
,
message
:
'请添加题目'
,
trigger
:
'change'
}],
questions
:
[{
required
:
true
,
message
:
'请添加题目'
,
trigger
:
'change'
}],
},
},
showEditQuestions
:
false
,
editQuestionsObj
:
{
show
:
false
},
questionsList
:
[],
questionsList
:
[],
userInfoFieldList
:
[]
userInfoFieldList
:
[],
controlOptions
:
[
'编辑'
,
'删除'
,
'上移'
,
'下移'
,
'最前'
,
'最后'
],
delObj
:
{},
delList
:
[]
}
}
},
},
mounted
()
{
mounted
()
{
this
.
getUserInfoFieldList
()
this
.
getUserInfoFieldList
()
this
.
addEvent
()
},
},
methods
:
{
methods
:
{
addEvent
()
{
const
_this
=
this
document
.
addEventListener
(
'keydown'
,
function
(
event
)
{
if
(
event
.
ctrlKey
&&
event
.
key
===
'z'
)
{
event
.
preventDefault
()
const
{
delList
}
=
_this
if
(
delList
.
length
)
{
const
{
index
,
questionsList
,
questions
}
=
delList
.
at
(
-
1
)
_this
.
questionsList
.
splice
(
index
,
0
,
questionsList
)
_this
.
configForm
.
questions
.
splice
(
index
,
0
,
questions
)
delList
.
pop
()
}
}
})
},
formRef
()
{
formRef
()
{
return
this
.
$refs
.
formRef
return
this
.
$refs
.
formRef
},
},
...
@@ -162,8 +215,8 @@ export default {
...
@@ -162,8 +215,8 @@ export default {
const
res
=
await
this
.
$apis
.
questionnaire
.
getUserInfoFieldList
()
const
res
=
await
this
.
$apis
.
questionnaire
.
getUserInfoFieldList
()
this
.
userInfoFieldList
=
res
||
[]
this
.
userInfoFieldList
=
res
||
[]
},
},
addQuestions
(
params
)
{
addQuestions
(
params
,
index
)
{
this
.
questionsList
.
push
(
params
)
params
.
itemValue
=
params
.
type
==
2
||
params
.
type
==
5
?
[]
:
''
const
obj
=
{
const
obj
=
{
type
:
params
.
type
,
type
:
params
.
type
,
required
:
params
.
required
,
required
:
params
.
required
,
...
@@ -172,8 +225,70 @@ export default {
...
@@ -172,8 +225,70 @@ export default {
}
}
if
(
params
.
type
==
3
)
obj
.
maxLength
=
params
.
data
if
(
params
.
type
==
3
)
obj
.
maxLength
=
params
.
data
else
obj
.
option
=
params
.
option
else
obj
.
option
=
params
.
option
this
.
configForm
.
questions
.
push
(
obj
)
if
(
index
>
-
1
)
{
this
.
questionsList
.
splice
(
index
,
1
,
params
)
this
.
configForm
.
questions
[
index
]
=
obj
}
else
{
this
.
questionsList
.
push
(
params
)
this
.
configForm
.
questions
.
push
(
obj
)
}
this
.
formRef
().
validateField
(
'questions'
)
this
.
formRef
().
validateField
(
'questions'
)
},
controlClick
(
index
,
ind
)
{
const
{
questionsList
}
=
this
,
{
questions
}
=
this
.
configForm
,
moveItem
=
(
array
,
originalIndex
,
newIndex
)
=>
{
if
(
originalIndex
<
0
||
originalIndex
>=
array
.
length
||
newIndex
<
0
||
newIndex
>=
array
.
length
)
return
array
const
elementToMove
=
array
[
originalIndex
]
array
.
splice
(
originalIndex
,
1
)
// 从原索引位置删除元素
array
.
splice
(
newIndex
,
0
,
elementToMove
)
// 在新索引位置插入元素
return
array
}
if
(
ind
==
0
)
{
this
.
editQuestionsObj
=
{
show
:
true
,
data
:
questionsList
[
index
],
index
}
}
else
if
(
ind
==
1
)
this
.
delObj
=
{
show
:
true
,
text
:
questionsList
[
index
].
text
,
index
}
else
{
const
targetIndex
=
{
2
:
index
-
1
,
3
:
index
+
1
,
4
:
0
,
5
:
questionsList
.
length
-
1
}[
ind
]
moveItem
(
questionsList
,
index
,
targetIndex
)
moveItem
(
questions
,
index
,
targetIndex
)
console
.
log
(
this
.
configForm
.
questions
)
}
},
delItem
()
{
const
{
index
}
=
this
.
delObj
,
{
questionsList
,
configForm
:
{
questions
}
}
=
this
this
.
delList
.
push
({
questionsList
:
questionsList
[
index
],
questions
:
questions
[
index
],
index
})
this
.
questionsList
.
splice
(
index
,
1
)
this
.
configForm
.
questions
.
splice
(
index
,
1
)
this
.
delObj
=
{
show
:
false
}
console
.
log
(
this
.
delList
)
},
controlDisabled
(
index
,
ind
)
{
const
{
questionsList
}
=
this
let
disabled
=
false
if
((
index
==
0
&&
(
ind
==
2
||
ind
==
4
))
||
(
index
==
questionsList
.
length
-
1
&&
(
ind
==
3
||
ind
==
5
)))
disabled
=
true
return
disabled
}
}
}
}
}
}
...
@@ -202,7 +317,7 @@ export default {
...
@@ -202,7 +317,7 @@ export default {
width
:
100%
;
width
:
100%
;
}
}
.item
{
.item
{
width
:
87
0px
;
width
:
99
0px
;
background
:
#f9f9f9
;
background
:
#f9f9f9
;
display
:
flex
;
display
:
flex
;
margin-bottom
:
16px
;
margin-bottom
:
16px
;
...
@@ -232,5 +347,13 @@ export default {
...
@@ -232,5 +347,13 @@ export default {
font-size
:
40px
;
font-size
:
40px
;
}
}
}
}
.control-box
{
display
:
flex
;
align-items
:
center
;
margin-left
:
auto
;
.el-button
+
.el-button
{
margin-left
:
10px
;
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/index.vue
View file @
2b3cf4f
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<el-button
<el-button
type=
"default"
type=
"default"
plain
plain
@
click=
"edit"
@
click=
"edit
Form
"
>
新建问卷
</el-button>
>
新建问卷
</el-button>
<el-button
<el-button
type=
"default"
type=
"default"
...
@@ -57,6 +57,18 @@
...
@@ -57,6 +57,18 @@
</div>
</div>
</el-popover>
</el-popover>
</
template
>
</
template
>
<
template
slot=
"status"
slot-scope=
"scope"
>
<div
:class=
"`status status-$
{scope.scope.status}`">
{{
{
'-1'
:
'已结束'
,
'0'
:
'待发布'
,
'1'
:
'已发布'
}
[
scope
.
scope
.
status
]
}}
<
/div
>
<
/template
>
<
span
<
span
slot
=
"auth-button"
slot
=
"auth-button"
slot
-
scope
=
"scope"
slot
-
scope
=
"scope"
...
@@ -104,6 +116,7 @@ export default {
...
@@ -104,6 +116,7 @@ export default {
searchForm
:
{
searchForm
:
{
merchantName
:
''
,
merchantName
:
''
,
name
:
''
,
name
:
''
,
statuses
:
'-1,0,1'
}
,
}
,
searchFormData
:
[
searchFormData
:
[
{
{
...
@@ -118,13 +131,25 @@ export default {
...
@@ -118,13 +131,25 @@ export default {
type
:
'input'
,
type
:
'input'
,
maxlength
:
100
maxlength
:
100
}
,
}
,
{
label
:
'状态'
,
name
:
'statuses'
,
type
:
'select'
,
maxlength
:
100
,
optionList
:
[
{
text
:
'全部'
,
id
:
'-1,0,1'
}
,
{
text
:
'已结束'
,
id
:
'-1'
}
,
{
text
:
'待发布'
,
id
:
'0'
}
,
{
text
:
'已发布'
,
id
:
'1'
}
,
],
optionId
:
'id'
,
optionLabel
:
'text'
}
,
],
],
getListApi
:
this
.
$apis
.
questionnaire
.
getQuestionnaireList
,
getListApi
:
this
.
$apis
.
questionnaire
.
getQuestionnaireList
,
tableParams
:
{
tableParams
:
{
listName
:
'data'
,
listName
:
'data'
,
tableOption
:
{
tableOption
:
true
,
width
:
'110px'
},
tableColumns
:
[
tableColumns
:
[
{
{
label
:
'问卷名称'
,
label
:
'问卷名称'
,
...
@@ -142,6 +167,11 @@ export default {
...
@@ -142,6 +167,11 @@ export default {
minWidth
:
100
minWidth
:
100
}
,
}
,
{
{
label
:
'状态'
,
minWidth
:
100
,
addHtml
:
'status'
}
,
{
label
:
'二维码'
,
label
:
'二维码'
,
minWidth
:
100
,
minWidth
:
100
,
addHtml
:
'qrcode'
addHtml
:
'qrcode'
...
@@ -156,8 +186,9 @@ export default {
...
@@ -156,8 +186,9 @@ export default {
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
,
}
,
}
,
condition
:
row
=>
row
.
status
!=
0
,
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
jumpDetail
(
row
)
click
:
row
=>
this
.
openData
(
row
)
}
}
}
,
}
,
{
{
...
@@ -166,13 +197,55 @@ export default {
...
@@ -166,13 +197,55 @@ export default {
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
,
}
,
}
,
condition
:
row
=>
row
.
status
==
1
,
listeners
:
{
listeners
:
{
click
:
row
=>
{
click
:
row
=>
{
this
.
dialogVisible
=
true
this
.
dialogVisible
=
true
this
.
closeParams
=
row
this
.
closeParams
=
row
}
}
}
}
,
{
type
:
'el-button'
,
name
:
'发布'
,
attrs
:
{
type
:
'text'
,
}
,
condition
:
row
=>
row
.
status
==
0
,
listeners
:
{
// click: row => this.jumpDetail(row)
}
}
,
{
type
:
'el-button'
,
name
:
'编辑'
,
attrs
:
{
type
:
'text'
,
}
,
condition
:
row
=>
row
.
status
==
0
,
listeners
:
{
click
:
row
=>
this
.
editForm
(
row
,
'edit'
)
}
}
,
{
type
:
'el-button'
,
name
:
'复制'
,
attrs
:
{
type
:
'text'
,
}
,
listeners
:
{
click
:
row
=>
this
.
copy
(
row
)
}
}
,
{
type
:
'el-button'
,
name
:
'详情'
,
attrs
:
{
type
:
'text'
,
}
,
}
,
condition
:
row
=>
row
.
status
!=
-
1
listeners
:
{
click
:
row
=>
this
.
editForm
(
row
)
}
}
,
}
,
],
],
dataObj
:
{
}
,
dataObj
:
{
}
,
...
@@ -190,7 +263,7 @@ export default {
...
@@ -190,7 +263,7 @@ export default {
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
handleSearch
()
this
.
handleSearch
()
}
,
}
,
jumpDetail
(
row
)
{
openData
(
row
)
{
this
.
dataObj
=
{
this
.
dataObj
=
{
show
:
true
,
show
:
true
,
...
row
...
row
...
@@ -216,11 +289,13 @@ export default {
...
@@ -216,11 +289,13 @@ export default {
download
(
url
)
{
download
(
url
)
{
util
.
downloadIamge
(
url
)
util
.
downloadIamge
(
url
)
}
,
}
,
edit
(
row
)
{
edit
Form
(
row
,
type
=
''
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/questionnaire/add'
,
path
:
'/questionnaire/add'
,
query
:
{
query
:
{
$title
:
row
.
id
?
'编辑问卷'
:
'新建问卷'
$title
:
row
.
id
?
type
==
'edit'
?
'编辑问卷'
:
'问卷详情'
:
'新建问卷'
,
id
:
row
.
id
,
type
}
}
}
)
}
)
}
}
...
@@ -275,24 +350,6 @@ export default {
...
@@ -275,24 +350,6 @@ export default {
width
:
200
px
;
width
:
200
px
;
height
:
200
px
;
height
:
200
px
;
}
}
/
deep
/
.over-box
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
height
:
100%
;
font-size
:
16px
;
color
:
#333333
;
gap
:
8px
;
.el-icon-warning
{
font-size
:
48px
;
color
:
#e6a23c
;
}
.tips
{
font-size
:
14px
;
color
:
#666666
;
}
}
.
download
-
img
{
.
download
-
img
{
cursor
:
pointer
;
cursor
:
pointer
;
margin
-
top
:
10
px
;
margin
-
top
:
10
px
;
...
@@ -302,4 +359,26 @@ export default {
...
@@ -302,4 +359,26 @@ export default {
line
-
height
:
20
px
;
line
-
height
:
20
px
;
text
-
align
:
center
;
text
-
align
:
center
;
}
}
.
status
{
display
:
flex
;
align
-
items
:
center
;
&
::
before
{
content
:
''
;
width
:
8
px
;
height
:
8
px
;
border
-
radius
:
100
%
;
margin
-
right
:
8
px
;
background
:
#
999999
;
}
}
.
status
-
0
{
&
::
before
{
background
:
#
f8b757
;
}
}
.
status
-
1
{
&
::
before
{
background
:
#
4
aca74
;
}
}
<
/style>
<
/style>
\ No newline at end of file
\ No newline at end of file
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